Position-based coefficients scaling

ABSTRACT

A video processing method includes determining, according to a rule, whether to apply a scaling matrix based on whether a secondary transform matrix is applied to a portion of a video block of a video, wherein the scaling matrix is used to scale at least some coefficients of the video block, and wherein the secondary transform matrix is used to transform at least some residual coefficients of the portion of the video block during the conversion; and performing a conversion between the video block of the video and a bitstream representation of the video using the selected scaling matrix.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Patent ApplicationNo. PCT/CN2020/110229, filed on Aug. 20, 2020, which claims the priorityto and benefits of International Patent Application No.PCT/CN2019/101555, filed on Aug. 20, 2019. All the aforementioned patentapplications are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

This patent document relates to video coding techniques, devices andsystems.

BACKGROUND

In spite of the advances in video compression, digital video stillaccounts for the largest bandwidth use on the internet and other digitalcommunication networks. As the number of connected user devices capableof receiving and displaying video increases, it is expected that thebandwidth demand for digital video usage will continue to grow.

SUMMARY

Devices, systems and methods related to digital video coding, andspecifically, to video coding and decoding that use scaling matricesand/or transform matrices.

In an example aspect, a method of video processing is disclosed. Themethod includes performing a conversion between a video block of a videoand a coded representation of the video, wherein the codedrepresentation conforms to a format rule, wherein the format rulespecifies that applicability of a transform skip mode to the video blockis determined by a coding condition of the video block, wherein theformat rule specifies that a syntax element indicative of applicabilityof the transform skip mode is omitted from the coded representation, andwherein the transform skip mode includes, skipping applying a forwardtransform to at least some coefficients prior to encoding into the codedrepresentation, or during decoding, skipping applying an inversetransform to at least some coefficients prior to decoding from the codedrepresentation.

In another example aspect, a method of video processing is disclosed.The method includes comprises determining, fora conversion between twoadjacent video blocks of a video and a coded representation of thevideo, whether an in-loop filter or a post-reconstruction filter is tobe used for the conversion depending on whether a forward transform oran inverse transform is used for the conversion, wherein the forwardtransform includes, skipping applying the forward transform to at leastsome coefficients prior to encoding into the coded representation, orduring decoding, skipping applying the inverse transform to at leastsome coefficients prior to decoding from the coded representation; andperforming the conversion based on the use of the in-loop filter or thepost-reconstruction filter.

In another example aspect, a method of video processing is disclosed.The method includes determining, for a conversion between a video blockof a video and a coded representation of the video, factors of a scalingtool based on a coding mode of the video block; and performing theconversion using the scaling tool, wherein the use of the scaling toolcomprises: scaling at least some coefficients representing the videoblock during encoding or descaling at least some coefficients from thecoded representation during decoding.

In another example aspect, a method of video processing is disclosed.The method includes determining, for a conversion between a video blockof a video and a coded representation of the video, to disable use of ascaling tool due to a block differential pulse code modulation (BDPCM)coding tool or a quantized residual BDPCM (QR-BDPCM) coding tool for theconversion of the video block; and performing the conversion withoutusing the scaling tool, wherein the use of the scaling tool comprises:scaling at least some coefficients representing the video block duringencoding or descaling at least some coefficients from the codedrepresentation during decoding.

In another example aspect, a method of video processing is disclosed.The method includes selecting, fora conversion between video blocks of avideo and a coded representation of the video, scaling matrices based ona transform matrix selected for the conversion, wherein the scalingmatrices are used to scale at least some coefficients of the videoblocks, and wherein the transform matrices are used to transform the atleast some coefficients of the video blocks during the conversion; andperforming the conversion using the scaling matrices.

In another example aspect, a method of video processing is disclosed.The method includes determining, according to a rule, whether to apply ascaling matrix based on whether a secondary transform matrix is appliedto a portion of a video block of a video, wherein the scaling matrix isused to scale at least some coefficients of the video block, and whereinthe secondary transform matrix is used to transform at least someresidual coefficients of the portion of the video block during theconversion; and performing a conversion between the video block of thevideo and a bitstream representation of the video using the selectedscaling matrix.

In another example aspect, a method of video processing is disclosed.The method includes determining, for a video block that has a non-squareshape, a scaling matrix for use in a conversion between the video blockof a video and a coded representation of the video, wherein a syntaxelement in the coded representation signals the scaling matrix, andwherein the scaling matrix is used to scale at least some coefficientsof the video blocks during the conversion; and performing the conversionbased on the scaling matrix.

In another example aspect, a method of video processing is disclosed.The method includes performing a conversion between a video block of avideo and a coded representation of the video, wherein the video blockcomprises a first number of positions at which a scaling matrix isapplied during the conversion and a second number of positions at whichthe scaling matrix is not applied during the conversion based on a rule.

In another example aspect, a method of video processing is disclosed.The method includes determining that a scaling matrix is to be appliedduring a conversion between a video block of a video and a codedrepresentation of the video; and performing the conversion based on thescaling matrix, wherein the coded representation indicates a number ofelements of the scaling matrix, and wherein the number depends onwhether coefficient zeroing out is applied to coefficients of the videoblock.

In another example aspect, a method of video processing is disclosed.The method includes performing a conversion between a video block of avideo and a coded representation of the video according to a rule,wherein the video block is represented in the coded representation afterzeroing out all but top-left M×N transform coefficients after applying aK×L transform matrix to transform coefficients of the video block,wherein the coded representation is configured to exclude signaling ofelements of a scaling matrix at positions corresponding to the zeroingout, wherein the scaling matrix is used for scaling the transformcoefficients.

In another example aspect, a method of video processing is disclosed.The method includes determining, during a conversion between a videoblock of a video and a coded representation of the video, based on arule whether a single quantization matrix is to be used based on a sizeof the video block, wherein all video blocks having the size use thesingle quantization matrix; and performing the conversion using thequantization matrix.

In another example aspect, a method of video processing is disclosed.The method includes determining, for a conversion between a codedrepresentation of a video block of a video and the video block, based ona coded mode information, whether a transform skip mode is enabled forthe conversion; and performing the conversion based on the determining;wherein, in the transform skip mode, application of a transform to atleast some coefficients representing the video block is skipped duringthe conversion.

In another example aspect, another method of video processing isdisclosed. The method includes determining to use a scaling matrix for aconversion between a coded representation of a video block and the videoblock due to a use of a block differential pulse code modulation (BDPCM)or a quantized residual BDPCM (QR-BDPCM) mode for the conversion; andperforming the conversion using the scaling matrix; wherein the scalingmatrix is used to scale at least some coefficients representing thevideo block during the conversion.

In another example aspect, another method of video processing isdisclosed. The method includes determining to disable use of a scalingmatrix for a conversion between a coded representation of a video blockand the video block due to a use of a block differential pulse codemodulation (BDPCM) or a quantized residual BDPCM (QR-BDPCM) mode for theconversion; and performing the conversion using the scaling matrix;wherein the scaling matrix is used to scale at least some coefficientsrepresenting the video block during the conversion.

In another example aspect, another method of video processing isdisclosed. The method includes determining, fora conversion between acoded representation of a video block of a video and the video block, anapplicability of an in-loop filter depending on whether a transform skipmode is enabled for the conversion; and performing the conversion basedon the applicability of the in-loop filter, wherein, in the transformskip mode, application of a transform to at least some coefficientsrepresenting the video block is skipped during the conversion.

In another example aspect, another method of video processing isdisclosed. The method includes selecting a scaling matrix for aconversion between video blocks of a video and a coded representation ofthe video blocks such that a same scaling matrix is selected for intercoding and intra block copy coding based conversion, and performing theconversion using the selected scaling matrix, wherein the scaling matrixis used to scale at least some coefficients of the video blocks.

In another example aspect, another method of video processing isdisclosed. The method includes selecting a scaling matrix for aconversion between video blocks of a video and a coded representation ofthe video blocks based on a transform matrix selected for theconversion, and performing the conversion using the selected scalingmatrix, wherein the scaling matrix is used to scale at least somecoefficients of the video blocks and wherein the transform matrix isused to transform at least some coefficients of the video block duringthe conversion.

In another example aspect, another method of video processing isdisclosed. The method includes selecting a scaling matrix for aconversion between video blocks of a video and a coded representation ofthe video blocks based on a secondary transform matrix selected for theconversion, and performing the conversion using the selected scalingmatrix, wherein the scaling matrix is used to scale at least somecoefficients of the video blocks and wherein the secondary transformmatrix is used to transform at least some residual coefficients of thevideo block during the conversion.

In another example aspect, another method of video processing isdisclosed. The method includes determining, fora video block that has anon-square shape, a scaling matrix for use in a conversion between thevideo block and a coded representation of the video block, wherein asyntax element in the coded representation signals the scaling matrix;and performing the conversion based on the scaling matrix, wherein thescaling matrix is used to scale at least some coefficients of the videoblocks during the conversion.

In another example aspect, another method of video processing isdisclosed. The method includes determining that a scaling matrix is tobe applied partially during a conversion between a coded representationof a video block and the video block; and performing the conversionbased by partially applying the scaling matrix such that the scalingmatrix is applied in a first set of positions and disabled at remainingpositions in the video block.

In another example aspect, another method of video processing isdisclosed. The method includes determining that a scaling matrix is tobe applied during a conversion between a coded representation of a videoblock and the video block; and performing the conversion based on thescaling matrix; wherein the coded representation signals a number ofelements of the scaling matrix, wherein the number depends onapplication of coefficient zeroing out in the conversion.

In another example aspect, another method of video processing isdisclosed. The method includes determining, during a conversion betweena video block and a coded representation of the video block, a singlequantization matrix to use based on a size of the video block being of aspecific type; and performing the conversion using the quantizationmatrix.

In yet another representative aspect, the above-described method isembodied in the form of processor-executable code and stored in acomputer-readable program medium.

In yet another representative aspect, a device that is configured oroperable to perform the above-described method is disclosed. The devicemay include a processor that is programmed to implement this method.

In yet another representative aspect, a video decoder apparatus mayimplement a method as described herein.

The above and other aspects and features of the disclosed technology aredescribed in greater detail in the drawings, the description and theclaims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an example video encoder implementation.

FIG. 2 shows an example of a secondary transform.

FIG. 3 shows an example of a reduced secondary transform (RST).

FIG. 4 is an illustration of the two scalar quantizers used in theproposed approach of dependent quantization.

FIG. 5 shows an example of state transition and quantizer selection forthe proposed dependent quantization.

FIGS. 6A-6B show examples of diagonal scan orders.

FIG. 7 shows an example of selected positions for QM signaling (32×32transform size).

FIG. 8 shows an example of selected positions for QM signaling (64×64transform size).

FIG. 9 shows an example of applying zeroing out to coefficients.

FIG. 10 shows an example of only selected elements in the dashed region(e.g., the M×N region) are signaled.

FIG. 11 is a block diagram of an example of a video processing hardwareplatform.

FIG. 12 is a flowchart of an example method of video processing.

FIG. 13 is a block diagram illustrating an example of video decoder.

FIG. 14 is a block diagram showing an example video processing system inwhich various techniques disclosed herein may be implemented.

FIG. 15 is a block diagram that illustrates an example video codingsystem that may utilize the techniques of this disclosure.

FIG. 16 is a block diagram illustrating an example of video encoder.

FIGS. 17-27 are flowcharts of example methods of video processing.

DETAILED DESCRIPTION

Embodiments of the disclosed technology may be applied to existing videocoding standards (e.g., HEVC, H.265) and future standards to improvecompression performance. Section headings are used in the presentdocument to improve readability of the description and do not in any waylimit the discussion or the embodiments (and/or implementations) to therespective sections only.

1. SUMMARY

This document is related to image/video coding technologies.Specifically, it is related to quantization matrix in image/videocoding. It may be applied to the existing video coding standard likeHEVC, or the standard (Versatile Video Coding) to be finalized. It maybe also applicable to future video coding standards or video codec.

2. BACKGROUND

Video coding standards have evolved primarily through the development ofthe well-known ITU-T and ISO/IEC standards. The ITU-T produced H.261 andH.263, ISO/IEC produced MPEG-1 and MPEG-4 Visual, and the twoorganizations jointly produced the H.262/MPEG-2 Video and H.264/MPEG-4Advanced Video Coding (AVC) and H.265/HEVC standards. Since H.262, thevideo coding standards are based on the hybrid video coding structurewherein temporal prediction plus transform coding are utilized. Toexplore the future video coding technologies beyond HEVC, Joint VideoExploration Team (JVET) was founded by VCEG and M PEG jointly in 2015.Since then, many new methods have been adopted by JVET and put into thereference software named Joint Exploration Model (JEM). In April 2018,the Joint Video Expert Team (JVET) between VCEG (Q6/16) and ISO/IEC JTC1SC29/WG11 (MPEG) was created to work on the VVC standard targeting at50% bitrate reduction compared to HEVC.

The latest version of VVC draft, i.e., Versatile Video Coding (Draft 5)could be found at:

http://phenix.it-sudparis.eu/jvet/doc_end_user/current_document.php?id=6640

The latest reference software of VVC, named VTM, could be found at:

https://vcgit.hhi.fraunhofer.de/jvet/VVCSoftware_VTM/tags/VTM-4.0

2.1. Color Space and Chroma Subsampling

Color space, also known as the color model (or color system), is anabstract mathematical model which simply describes the range of colorsas tuples of numbers, typically as 3 or 4 values or color components(e.g. RGB). Basically speaking, color space is an elaboration of thecoordinate system and sub-space.

For video compression, the most frequently used color spaces are YCbCrand RGB.

YCbCr, Y′CbCr, or Y Pb/Cb Pr/Cr, also written as YCBCR or Y′CBCR, is afamily of color spaces used as a part of the color image pipeline invideo and digital photography systems. Y′ is the luma component and CBand CR are the blue-difference and red-difference chroma components. Y′(with prime) is distinguished from Y, which is luminance, meaning thatlight intensity is nonlinearly encoded based on gamma corrected RGBprimaries.

Chroma subsampling is the practice of encoding images by implementingless resolution for chroma information than for luma information, takingadvantage of the human visual system's lower acuity for colordifferences than for luminance.

2.1.1. 4:4:4

Each of the three Y′CbCr components have the same sample rate, thusthere is no chroma subsampling. This scheme is sometimes used inhigh-end film scanners and cinematic post production.

2.1.2. 4:2:2

The two chroma components are sampled at half the sample rate of luma:the horizontal chroma resolution is halved. This reduces the bandwidthof an uncompressed video signal by one-third with little to no visualdifference

2.1.3. 4:2:0

In 4:2:0, the horizontal sampling is doubled compared to 4:1:1, but asthe Cb and Cr channels are only sampled on each alternate line in thisscheme, the vertical resolution is halved. The data rate is thus thesame. Cb and Cr are each subsampled at a factor of 2 both horizontallyand vertically. There are three variants of 4:2:0 schemes, havingdifferent horizontal and vertical siting.

In MPEG-2, Cb and Cr are cosited horizontally. Cb and Cr are sitedbetween pixels in the vertical direction (sited interstitially).

In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are sited interstitially,halfway between alternate luma samples.

In 4:2:0 DV, Cb and Cr are co-sited in the horizontal direction. In thevertical direction, they are co-sited on alternating lines.

2.2. Coding Flow of a Typical Video Codec

FIG. 1 shows an example of encoder block diagram of VVC, which containsthree in-loop filtering blocks: deblocking filter (DF), sample adaptiveoffset (SAO) and ALF. Unlike DF, which uses predefined filters, SAO andALF utilize the original samples of the current picture to reduce themean square errors between the original samples and the reconstructedsamples by adding an offset and by applying a finite impulse response(FIR) filter, respectively, with coded side information signaling theoffsets and filter coefficients. ALF is located at the last processingstage of each picture and can be regarded as a tool trying to catch andfix artifacts created by the previous stages.

2.3. Quantization Matrix

The well-known spatial frequency sensitivity of the human visual system(HVS), has been a key driver behind many aspects of the design of modernimage and video coding algorithms and standards including JPEG, MPEG2,H.264/AVC High Profile and the HEVC.

The quantization matrix used in MPEG2 is an 8×8 matrix. In H.264/AVC,the quantization matrix block size includes both 4×4 and 8×8. These QMsare encoded in SPS (sequence parameter set) and PPS (picture parametersset). The compressed method in H.264/AVC for QM signalling isDifferential Pulse Code Modulation (DPCM).

In H.264/AVC High Profile, 4×4 block size and 8×8 block size are used.Six QMs for 4×4 block size (i.e. separate matrix for intra/inter codingand Y/Cb/Cr components) and two QMs for 8×8 block size (i.e. separatematrix for intra/inter Y component), so only eight quantization matricesneed to be encoded into bitstream.

2.4. Transform and Quantization Design in VVC 2.4.1. Transform

HEVC specifies two-dimensional transforms of various sizes from 4×4 to32×32 that are finite precision approximations to the discrete cosinetransform (DCT). In addition, HEVC also specifies an alternate 4×4integer transform based on the discrete sine transform (DST) for usewith 4×4 luma Intra prediction residual blocks. In addition to that,when certain block sizes, transform skip may be also allowed.

The transform matrices cij (i, j=0 . . . nS−1) for nS=4, 8, 16, and 32,DCT-II are defined as follows:

nS=4{64, 64, 64, 64}{83, 36,−36,−83}{64,−64,−64, 64}{36,−83, 83,−36}nS=8{64, 64, 64, 64, 64, 64, 64, 64}{89, 75, 50, 18,−18,−50,−75,−89}{83, 36,−36,−83,−83,−36, 36, 83}{75,−18,−89,−50, 50, 89, 18,−75}{64,−64,−64, 64, 64,−64,−64, 64}{50,−89, 18, 75,−75,−18, 89,−50}{36,−83, 83,−36,−36, 83,−83, 36}{18,−50, 75,−89, 89,−75, 50,−18}nS=16{64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64}{90 87 80 70 57 43 25 9 −9 −25−43−57−70−80−87−90}{89 75 50 1 8−1 8−50−75−89−89−75−50− 18 18 50 75 89}{87 57 9−43−80−90−70−25 25 70 90 80 43 −9−57−87}{83 36−36−83−83−36 36 83 83 36−36−83−83−36 36 83}{80 9−70−87−25 57 90 43−43−90−57 25 87 70 −9−80}{75−18−89−50 50 89 18−75−75 18 89 50−50−89−18 75}{70−43−87 9 90 25−80−57 57 80−25−90 −9 87 43−70}{64−64−64 64 64−64−64 64 64−64−64 64 64−64−64 64}{57−80−25 90 −9−87 43 70−70−43 87 9−90 25 80−57}{50−89 18 75−75−18 89−50−50 89−18−75 75 18−89 50}{43−90 57 25−87 70 9−80 80 −9−70 87−25−57 90−43}{36−83 83−36−36 83−83 36 36−83 83−36−36 83−83 36}{25−70 90−80 43 9−57 87−87 57 −9−43 80−90 70−25}{18−50 75−89 89−75 50−18−18 50−75 89−89 75−50 18}{9−25 43−57 70−80 87−90 90−87 80−70 57−43 25−9}nS=32{64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 6464 64 64 64 64 64 64 64}{90 90 88 85 82 78 73 67 61 54 46 38 31 22 13 4−4−13−22−31−38−46−54−61−67−73−78−82−85−88− 90−90}{90 87 80 70 57 43 25 9 −9−25−43−57−70−80−87−90−90−87−80−70−57−43−25 −99 25 43 57 70 80 87 90}{90 82 67 46 22 −4−31−54−73−85−90−88−78−61−38−13 13 38 61 78 88 90 85 7354 31 4−22−46−67− 82−90}{89 75 50 18−18−50−75−89−89−75−50−18 18 50 75 89 89 75 5018−18−50−75−89−89−75−50−18 18 50 75 89}{88 67 31−13−54−82−90−78−46 −4 38 73 90 85 61 22−22−61−85−90−73−38 4 4678 90 82 54 13−31− 67−88}{87 57 9−43−80−90−70−25 25 70 90 80 43−9−57−87−87−57 −9 43 80 90 7025−25−70−90−80−43 9 57 87}{85 46−13−67−90−73−22 38 82 88 54−4−61−90−78−31 31 78 90 614−54−88−82−38 22 73 90 67 13− 46−85}{83 36−36−83−83−36 36 83 83 36−36−83−83−36 36 83 83 36−36−83−83−36 36 8383 36−36−83−83−36 36 83}{82 22−54−90−61 13 78 85 31−46−90−67 4 73 88 38−38−88−73 −4 67 9046−31−85−78−13 61 90 54− 22−82}{80 9−70−87−25 57 90 43−43−90−57 25 87 70 −9−80−80 −9 70 87 25−57−90−4343 90 57−25−87−70 9 80}{78 −4−82−73 13 85 67−22−88−61 31 90 54−38−90−46 46 90 38−54−90−31 61 8822−67−85−13 73 82 4−78}{75−18−89−50 50 89 18−75−75 18 89 50−50−89−18 75 75−18−89−50 50 8918−75−75 18 89 50−50− 89−18 75}{73−31−90−22 78 67−38−90−13 82 61−46−88−4 85 54−54−85 4 88 46−61−82 1390 38−67−78 22 90 31−73}{70−43−87 9 90 25−80−57 57 80−25−90−9 87 43−70−70 43 87 −9−90−25 8057−57−80 25 90 9−87− 43 70}{67−54−78 38 85−22−90 4 90 13−88−31 82 46−73−61 61 73−46−82 31 88−13−90−4 90 22−85−38 78 54−67}{64−64−64 64 64−64−64 64 64−64−64 64 64−64−64 64 64−64−64 64 64−64−64 6464−64−64 64 64− 64−64 64}{61−73−46 82 31−88−13 90 −4−90 22 85−38−78 54 67−67−54 78 38−85−22 904−90 13 88−31−82 46 73−61}{57−80−25 90−9−87 43 70−70−43 87 9−90 25 80−57−57 80 25−90 9 87−43−70 7043−87 −9 90−25− 80 57}{54−85 −4 88−46−61 82 13−90 38 67−78−22 90−31−73 73 31−90 22 78−67−3890−13−82 61 46−88 4 85−54}{50−89 18 75−75−18 89−50−50 89−18−75 75 18−89 50 50−89 18 75−75−1889−50−50 89−18−75 75 18−89 50}{46−90 38 54−90 31 61−88 22 67−85 13 73−82 4 78−78−4 82−73−13 85−67−2288−61−31 90−54−38 90−46}{43−90 57 25−87 70 9−80 80−9−70 87−25−57 90−43−43 90−57−25 87−70 −980−80 9 70−87 25 57− 90 43}{38−88 73 −4−67 90−46−31 85−78 13 61−90 54 22−82 82−22−54 90−61−13 78−8531 46−90 67 4−73 88−38}{36−83 83−36−36 83−83 36 36−83 83−36−36 83−83 36 36−83 83−36−36 83−83 3636−83 83−36−36 83−83 36}{31−78 90−61 4 54−88 82−38−22 73−90 67−13−46 85−85 46 13−67 90−73 2238−82 88−54 −4 61−90 78−31}{25−70 90−80 43 9−57 87−87 57 −9−43 80−90 70−25−25 70−90 80−43−9 57−8787−57 9 43−80 90− 70 25}{22−61 85−90 73−38 −4 46−78 90−82 54−13−31 67−88 88−67 31 13−54 82−9078−46 4 38−73 90−85 61−22}{18−50 75−89 89−75 50−1 8−1 8 50−75 89−89 75−50 18 18−50 75−89 89−7550−1 8−1 8 50−75 89−89 75−50 18}{13−38 61−78 88−90 85−73 54−31 4 22−46 67−82 90−90 82−67 46−22−4 31−5473−85 90−88 78−61 38−13}{9−25 43−57 70−80 87−90 90−87 80−70 57−43 25 −9 −9 25−43 57−70 80−8790−90 87−80 70−57 43− 25 9}{4−13 22−31 38−46 54−61 67−73 78−82 85−88 90−90 90−90 88−85 82−78 73−6761−54 46−38 31−22 13−4}

2.4.2. Quantization

The HEVC quantizer design is similar to that of H.264/AVC where aquantization parameter (QP) in the range of 0-51 (for 8-bit videosequences) is mapped to a quantizer step size that doubles each time theQP value increases by 6. A key difference, however, is that thetransform basis norm correction factors incorporated into the descalingmatrices of H.264/AVC are no longer needed in HEVC simplifying thequantizer design. A QP value can be transmitted (in the form of deltaQP) for a quantization group as small as 8×8 samples for rate controland perceptual quantization purposes. The QP predictor used forcalculating the delta QP uses a combination of left, above and previousQP values. HEVC also supports frequency-dependent quantization by usingquantization matrices for all transform block sizes. Details will bedescribed in section 2.4.3.

The quantized transform coefficients q_(ij)(i, j=0 . . . nS−1) arederived from the transform coefficients d_(ij) (i, j=0 . . . nS−1) as:

q _(ij)=(d _(ij) *f[QP%6]+offset)>>(29+QP/6−nS−BitDepth), with i,j=0, .. . ,nS−1

where

f[x]={26214,23302,20560,18396,16384,14564},x=0, . . . ,5

2^(28+QP/6−nS-BitDepth)<offset<2^(29+QP/6−nS-BitDepth)

QP represents the quantization parameter for one transform unit, andBitDepth represents the bit depth associated with the current colorcomponent.

In HEVC, the range of QP is [0, 51].

2.4.3. Quantization Matrix

Quantization matrix (QM) has been adopted in image coding standards suchas JPEG and JPEG-2000, as well as in video standards such as MPEG2,MPEG4 and H.264/AVC. QM can improve the subjective quality throughfrequency weighting on different frequency coefficients. In the HEVCstandard, the quantization block sizes can go up to 32×32. QMs with thesize of 4×4, 8×8, 16×16, 32×32 could be encoded in the bitstream. Foreach block size, intra/inter prediction types and Y/Cb/Cr colorcomponents need different quantization matrix. In total 24 quantizationmatrices (separate matrices for 4×4, 8×8, 16×16 and 32×32 four blocksizes, intra/inter and Y, U, V components) should be encoded.

The parameters for a quantization matrix may be directly copied from areference quantization matrix or may be explicitly signaled. When theyare explicitly signaled, the first parameter (a.k.a., value of the (0,0)component of the matrix) is directly coded. And the remaining parametersare coded with predictive coding according to the raster scan of thematrix.

Encoding and signalling of scaling matrices in HEVC implies three modes:OFF, DEFAULT, and USER_DEFINED. It is noted that: for transform unitsizes larger than 8×8 (i.e., 16×16, 32×32), the scaling matrix isobtained from the 8×8 scaling matrix by upsampling to a bigger size(duplication of elements). An additional DC value has to be signalledfor scaling matrices of TBs bigger than 8×8.

The maximum number of coded values for one scaling matrix in HEVC isequal to 64.

The DC value for DEFAULT mode is equal to 16 for all TB sizes.

2.4.3.1. Syntax and Semantics 7.3.2.2 Sequence Parameter Set RBSP Syntax7.3.2.2.1 General Sequence Parameter Set RBSP Syntax

Descriptor seq_parameter_set_rbsp( ) {  sps_video_parameter_set_id u(4)...  max_transform_hierarchy_depth_intra ue(v) scaling_list_enabled_flag u(1)  if( scaling_list_enabled_flag ) {  sps_scaling_list_data_present_flag u(1)   if(sps_scaling_list_data_present_flag )    scaling_list_data( )  } amp_enabled_flag u(1) ...  rbsp_trailing_bits( ) }

7.3.2.3 Picture Parameter Set RBSP Syntax 7.3.2.3.1 General PictureParameter Set RBSP Syntax

Descriptor pic_parameter_set_rbsp( ) {  pps_pic_parameter_set_id ue(v)...  if( deblocking_filter_control_present_flag ) { ...  } pps_scaling_list_data_present flag u(1)  if(pps_scaling_list_data_present_flag )   scaling_list_data( ) lists_modification_present_flag u(1) ...  rbsp_trailing_bits( ) }

7.3.4 Scaling List Data Syntax

Descriptor scaling_list_data( ) {  for( sizeId = 0; sizeId < 4; sizeId++)   for( matrixId = 0; matrixId < 6; matrixId += (   sizeId = = 3) ? 3: 1) {    scaling_list_pred_mode_flag[ sizeId ][ u(1)    matrixId ]   if( !scaling_list_pred_mode_flag[ sizeId ][    matrixId ] )    scaling_list_pred_matrix_id_delta[ ue(v)     sizeId ][ matrixId ]   else {     nextCoef = 8     coefNum = Min( 64, ( 1 << ( 4 + (    sizeId << 1 ) ) ) )     if( sizeId > 1 ) {     scaling_list_dc_coef_minus8[ sizeId − se(v)      2 ][ matrixId ]     nextCoef = scaling_list_dc_coef_minus8[       sizeId − 2 ][matrixId ] + 8     }     for( i = 0; i < coefNum, i++) {     scaling_list_detta_coef se(v)      nextCoef = ( nextCoef +     scaling_list_delta_coef + 256) % 256      ScalingList[ sizeId ][matrixId ][ i ] =      nextCoef     }    }   } }scaling_list_enabled_flag equal to 1 specifies that a scaling list isused for the scaling process for transform coefficients.scaling_list_enabled_flag equal to 0 specifies that scaling list is notused for the scaling process for transform coefficients.

sps_scaling_list_data_present_flag equal to 1 specifies that thescaling_list_data( ) syntax structure is present in the SPS.sps_scaling_list_data_present_flag equal to 0 specifies that thescaling_list_data( ) syntax structure is not present in the SPS. Whennot present, the value of sps_scaling_list_data_present_flag is inferredto be equal to 0.

pps_scaling_list_data_present_flag equal to 1 specifies that the scalinglist data used for the pictures referring to the PPS are derived basedon the scaling lists specified by the active SPS and the scaling listsspecified by the PPS. pps_scaling_list_data_present_flag equal to 0specifies that the scaling list data used for the pictures referring tothe PPS are inferred to be those specified by the active SPS. Whenscaling_list_enabled_flag is equal to 0, the value ofpps_scaling_list_data_present_flag shall be equal to 0. When scalinglist enabled flag is equal to 1, sps_scaling_list_data_present_flag isequal to 0, and pps_scaling_list_data_present_flag is equal to 0, thedefault scaling list data are used to derive the array ScalingFactor asdescribed in the scaling list data semantics as specified in clause7.4.5.

7.4.5 Scaling List Data Semantics

scaling_list_pred_mode_flag[sizeId][matrixId] equal to 0 specifies thatthe values of the scaling list are the same as the values of a referencescaling list. The reference scaling list is specified byscaling_list_pred_matrix_id_delta[sizeId][matrixId].scaling_list_pred_mode_flag[sizeId][matrixId] equal to 1 specifies thatthe values of the scaling list are explicitly signalled.scaling_list_pred_matrix_id_delta[sizeId][matrixId] specifies thereference scaling list used to derive ScalingList[sizeId][matrixId] asfollows:

-   -   If scaling_list_pred_matrix_id_delta[sizeId][matrixId] is equal        to 0, the scaling list is inferred from the default scaling list        ScalingList[sizeId][matrixId][i] as specified in Table 7-5 and        Table 7-6 for i=0 . . . Min(63, (1<<(4+(sizeId<<1)))−1).    -   Otherwise, the scaling list is inferred from the reference        scaling list as follows:

refMatrixId=matrixId−scaling_list_pred_matrix_id_delta[sizeId][matrixId]*(sizeId==3?:1)  (7-42)

ScalingList[sizeId][matrixId][i]=ScalingList[sizeId][refMatrixId][i]with i=0 . . . Min(63,(1<<(4+(sizeId<<1)))−1)  (7-43)

If sizeId is less than or equal to 2, the value ofscaling_list_pred_matrix_id_delta[sizeId][matrixId] shall be in therange of 0 to matrixId, inclusive. Otherwise (sizeId is equal to 3), thevalue of scaling_list_pred_matrix_id_delta[sizeId][matrixId] shall be inthe range of 0 to matrixId/3, inclusive.

TABLE 7-3 Specification of sizeId Size of quantization matrix sizeId 4 ×4 0 8 × 8 1 16 × 16 2 32 × 32 3

TABLE 7-4 Specification of matrixId according to sizeId, prediction modeand colour component cIdx (colour sizeId CuPredMode component) matrixId0, 1, 2, 3 MODE_INTRA 0 (Y) 0 0, 1, 2, 3 MODE_INTRA 1 (Cb) 1 0, 1, 2, 3MODE_INTRA 2 (Cr) 2 0, 1, 2, 3 MODE_INTER 0 (Y) 3 0, 1, 2, 3 MODE_INTER1 (Cb) 4 0, 1, 2, 3 MODE_INTER 2 (Cr) 5scaling_list_dc_coef_minus8[sizeId−2][matrixId] plus 8 specifies thevalue of the variable ScalingFactor[2][matrixId][0][0] for the scalinglist for the 16×16 size when sizeId is equal to 2 and specifies thevalue of ScalingFactor[3][matrixId][0][0] for the scaling list for the32×32 size when sizeId is equal to 3. The value ofscaling_list_dc_coef_minus8[sizeId−2][matrixId] shall be in the range of−7 to 247, inclusive.When scaling_list_pred_mode_flag[sizeId][matrixId] is equal to 0,scaling_list_pred_matrix_id_delta[sizeId][matrixId] is equal to 0, andsizeId is greater than 1, the value ofscaling_list_dc_coef_minus8[sizeId−2][matrixId] is inferred to be equalto 8.When scaling_list_pred_matrix_id_delta[sizeId][matrixId] is not equal to0 and sizeId is greater than 1, the value ofscaling_list_dc_coef_minus8[sizeId−2][matrixId] is inferred to be equalto scaling_list_dc_coef_minus8[sizeId−2][refMatrixId], where the valueof refMatrixId is given by Equation 7-42.

scaling_list_delta_coef specifies the difference between the currentmatrix coefficient ScalingList[sizeId][matrixId][i] and the previousmatrix coefficient ScalingList[sizeId][matrixId][i−1], whenscaling_list_pred_mode_flag[sizeId][matrixId] is equal to 1. The valueof scaling_list_delta_coef shall be in the range of −128 to 127,inclusive. The value of ScalingList[sizeId][matrixId][i] shall begreater than 0.

TABLE 7-5 Specification of default values of ScalingList[ 0 ][ matrixId][ i ] with i = 0..15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15ScalingList[0] 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 [ 0..5 ][i ]

TABLE 7-6 Specification of default values of ScalingList[ 1..3 ][matrixId ][ i ] with i = 0..63 i 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1  15 0 1 23 4 ScalingList[ 1..3 ][ 0..2 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  18 66 6 6 6 6 6 6 6 6 7 6 7 6 7 ScalingList[ 1..3 ][ 3..5 ][ i ] 1 1 1 1 1 11 1 1 1 1 1 1 1 1  18 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 i - 16 0 1 2 3 4 5 67 8 9 1 1 1 1 1  15 0 1 2 3 4 ScalingList[ 1..3 ][ 0..2 ][ i ] 1 1 1 1 12 1 2 2 2 1 2 2 2 2  24 7 8 8 7 8 1 9 0 1 0 9 1 4 2 2 ScalingList[ 1..3][ 3..5 ][ i ] 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2  24 8 8 8 8 8 0 0 0 0 0 0 04 4 4 i - 32 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1  15 0 1 2 3 4 ScalingList[1..3 ][ 0..2 ][ i ] 2 2 2 2 2 2 2 3 2 2 2 2 3 3 3  31 4 2 2 4 5 5 7 0 75 5 9 1 5 5 ScalingList[ 1..3 ][ 3..5 ][ i ] 2 2 2 2 2 2 2 2 2 2 2 2 2 22  28 4 4 4 4 5 5 5 5 5 5 5 8 8 8 8 i - 48 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 1 2 3 4 ScalingList[ 1..3 ][ 0..2 ][ i ] 2 3 4 4 4 3 4 5 5 4 6 7 68 8 115 9 6 1 4 1 6 7 4 4 7 5 0 5 8 8 ScalingList[ 1..3 ][ 3..5 ][ i ] 23 3 3 3 3 4 4 4 4 5 5 5 7 7  91 8 3 3 3 3 3 1 1 1 1 4 4 4 1 1The four-dimensional array ScalingFactor[sizeId][matrixId][x][y], withx, y=0 . . . (1<<(2+sizeId))−1, specifies the array of scaling factorsaccording to the variables sizeId specified in Table 7-3 and matrixIdspecified in Table 7-4The elements of the quantization matrix of size 4×4,ScalingFactor[0][matrixId][ ][ ], are derived as follows:

ScalingFactor[0][matrixId][x][y]=ScalingList[0][matrixId][i]  (7-44)

-   -   with i=0 . . . 15, matrixId=0 . . . 5, x=ScanOrder[2][0][i][0],        and        -   y=ScanOrder[2][0][i][1]            The elements of the quantization matrix of size 8×8,            ScalingFactor[1][matrixId][ ][ ], are derived as follows:

ScalingFactor[1][matrixId][x][y]=ScalingList[1][matrixId][i]  (7-45)

-   -   with i=0 . . . 63, matrixId=0 . . . 5, x=ScanOrder[3][0][i][0],        and        -   y=ScanOrder[3][0][i][1]            The elements of the quantization matrix of size 16×16,            ScalingFactor[2][matrixId][ ][ ], are derived as follows:

ScalingFactor[2][matrixId][x*2+k][y*2+j]=ScalingList[2][matrixId][i]  (7-46)

-   -   with i=0 . . . 63, j=0 . . . 1, k=0 . . . 1, matrixId=0 . . . 5,        x=ScanOrder[3][0][i][0],        -   and y=ScanOrder[3][0][i][1]

ScalingFactor[2][matrixId][0][0]=scaling_list_dc_coef_minus8[0][matrixId]+8  (7-47)

-   -   with matrixId=0 . . . 5        The elements of the quantization matrix of size 32×32,        ScalingFactor[3][matrixId][ ][ ], are derived as follows:

ScalingFactor[3][matrixId][x*4+k][y*4+j]=ScalingList[3][matrixId][i]  (7-48)

-   -   with i=0 . . . 63, j=0 . . . 3, k=0 . . . 3, matrixId=0, 3,        x=ScanOrder[3][0][i][0],        -   and y=ScanOrder[3][0][i][1]

ScalingFactor[3][matrixId][0][0]=scaling_list_dc_coef_minus8[1][matrixId]+8  (7-49)

-   -   with matrixId=0, 3        When ChromaArrayType is equal to 3, the elements of the chroma        quantization matrix of size 32×32, ScalingFactor[3][matrixId][        ][ ], with matrixId=1, 2, 4, and 5, are derived as follows:

ScalingFactor[3][matrixId][x*4+k][y*4+j]=ScalingList[2][matrixId][i]  (7-50)

-   -   with i=0 . . . 63, j=0 . . . 3, k=0 . . . 3,        x=ScanOrder[3][0][i][0], and        -   y=ScanOrder[3][0][i][1]

ScalingFactor[3][matrixId][0][0]=scaling_list_dc_coef_minus8[0][matrixId]+8  (7-51)

2.5. Transform and Quantization Design in VVC 2.5.1. MTS (MultipleTransform Selection)

The discrete sinusoidal transform families include the well-knowndiscrete Fourier, cosine, sine, and the Karhunen-Loeve (underfirst-orderMarkov condition) transforms. Among all the members, there are 8 typesof transforms based on cosine functions and 8 types of transforms basedon sine functions, namely DCT-I, II, . . . , VIII, and DST-I, II, . . ., VIII, respectively. These variants of discrete cosine and sinetransforms originate from the different symmetry of their correspondingsymmetric-periodic sequences [22]. The transform basis functions ofselected types of DCT and DST, as utilized in the proposed methods, areformulated in below Table 1.

TABLE 1 Transform basis function of DCT-II/V/VIII and DSTI/VII forN-point input. Transform Type Basis function T_(i)(j), i, j = 0, 1, . .. , N − 1 DCT2${T_{i}(j)} = {\omega_{0} \cdot \sqrt{\frac{2}{N}} \cdot {\cos( \frac{\pi \cdot i \cdot ( {{2j} + 1} )}{2N} )}}$${{where}\mspace{14mu}\omega_{0}} = \{ \begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix} $ DCT5${{T_{i}(j)} = {\omega_{0} \cdot \omega_{1} \cdot \sqrt{\frac{2}{{2N} - 1}} \cdot {\cos( \frac{2{\pi \cdot i \cdot j}}{{2N} - 1} )}}},$${{where}\mspace{14mu}\omega_{0}} = \{ {\begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix},{\omega_{1} = \{ \begin{matrix}\sqrt{\frac{2}{N}} & {j = 0} \\1 & {j \neq 0}\end{matrix} }} $ DCT8${T_{i}(j)} = {\sqrt{\frac{4}{{2N} + 1}} \cdot {\cos( \frac{\pi \cdot ( {{2i} + 1} ) \cdot ( {{2j} + 1} )}{{4N} + 2} )}}$DST1${T_{i}(j)} = {\sqrt{\frac{2}{N + 1}} \cdot {\sin( \frac{\pi \cdot ( {i + 1} ) \cdot ( {j + 1} )}{N + 1} )}}$DST7${T_{i}(j)} = {\sqrt{\frac{4}{{2N} + 1}} \cdot {\sin( \frac{\pi \cdot ( {{2i} + 1} ) \cdot ( {j + 1} )}{{2N} + 1} )}}$

For one block, either transform skip or DCT2/DST7/DCT8 may be selected.Such a method is called multiple transform selection (MTS).

In order to control MTS scheme, separate enabling flags are specified atSPS level for intra and inter, respectively. When MTS is enabled at SPS,a CU level flag is signalled to indicate whether MTS is applied or not.Here, MTS is applied only for luma. The MTS CU level flag is signalledwhen the following conditions are satisfied.

-   -   Both width and height smaller than or equal to 32    -   CBF flag is equal to one

If MTS CU flag is equal to zero, then DCT2 is applied in bothdirections. However, if MTS CU flag is equal to one, then two otherflags are additionally signalled to indicate the transform type for thehorizontal and vertical directions, respectively. Transform andsignalling mapping table as shown in the table below. When it comes totransform matrix precision, 8-bit primary transform cores are used.Therefore, all the transform cores used in HEVC are kept as the same,including 4-point DCT-2 and DST-7, 8-point, 16-point and 32-point DCT-2.Also, other transform cores including 64-point DCT-2, 4-point DCT-8,8-point, 16-point, 32-point DST-7 and DCT-8, use 8-bit primary transformcores.

TABLE 6 Transform basis functions of DCT-II/V/VIII and DSTI/VII forN-point input. Infra/inter MTS_CU_flag MTS_Hor_flag MTS_Ver_flagHorizontal Vertical 0 DCT2 1 0 0 DST7 DST7 0 1 DCT8 DST7 1 0 DST7 DCT8 11 DCT8 DCT8

As in HEVC, the residual of a block can be coded with transform skipmode. To avoid the redundancy of syntax coding, the transform skip flagis not signalled when the CU level MTS_CU_flag is not equal to zero. Theblock size limitation for transform skip is the same to that for MTS inJEM4, which indicate that transform skip is applicable for a CU whenboth block width and height are equal to or less than 32.

2.5.1.1. Zeroing-Out of High Frequency

In VTM4, large block-size transforms, up to 64×64 in size, are enabled,which is primarily useful for higher resolution video, e.g., 1080p and4K sequences. High frequency transform coefficients are zeroed out forthe transform blocks with size (width or height, or both width andheight) equal to 64, so that only the lower-frequency coefficients areretained. For example, for an M×N transform block, with M as the blockwidth and N as the block height, when M is equal to 64, only the left 32columns of transform coefficients are kept. Similarly, when N is equalto 64, only the top 32 rows of transform coefficients are kept. Whentransform skip mode is used for a large block, the entire block is usedwithout zeroing out any values.

To reduce the complexity of large size DST-7 and DCT-8, High frequencytransform coefficients are zeroed out for the DST-7 and DCT-8 blockswith size (width or height, or both width and height) equal to 32. Onlythe coefficients within the 16×16 lower-frequency region are retained.

2.5.2. Reduced Secondary Transform

In JEM, secondary transform is applied between forward primary transformand quantization (at encoder) and between de-quantization and inverseprimary transform (at decoder side). As shown in FIG. 2, 4×4 (or 8×8)secondary transform is performed depends on block size. For example, 4×4secondary transform is applied for small blocks (i.e., min (width,height)<8) and 8×8 secondary transform is applied for larger blocks(i.e., min (width, height)>4) per 8×8 block.

For the secondary transforms, non-separable transforms are applied,therefore, it is also named as Non-Separable Secondary Transform (NSST).There are totally 35 transform sets and 3 non-separable transformmatrices (kernels, each one with 16×16 matrix) per transform set areused.

The Reduced Secondary Transform (RST) was introduced in JVET-K0099 and 4transform sets (instead of 35 transform sets) mapping introduced inJVET-L0133 according to intra prediction direction. In thiscontribution, 16×48 and 16×16 matrices are employed for 8×8 and 4×4blocks, respectively. For notational convenience, 16×48 transform isdenoted as RST8×8 and the 16×16 one as RST4×4. Such a method wasrecently adopted by VVC.

FIG. 3 shows an example of a Reduced Secondary Transform (RST).

Secondary forward and inverse transforms are a separate process stepfrom that of primary transforms

For encoder, the primary forward transform is performed first, thenfollowed by secondary forward transform and quantization, and CABAC bitencoding. For decoder, CABAC bit decoding and inverse quantization, thenSecondary inverse transform is performed first, then followed by primaryinverse transform.

RST applies only to intra coded TUs.

2.5.3. Quantization

In VTM4, Maximum QP was extended from 51 to 63, and the signaling ofinitial QP was changed accordingly. The initial value of SliceQpY ismodified at the slice segment layer when a non-zero value ofslice_qp_delta is coded. Specifically, the value of init_qp_minus26 ismodified to be in the range of −(26+QpBdOffsetY) to +37.

In addition, the same HEVC scalar quantization is used with a newconcept called dependent scala quantization. Dependent scalarquantization refers to an approach in which the set of admissiblereconstruction values for a transform coefficient depends on the valuesof the transform coefficient levels that precede the current transformcoefficient level in reconstruction order. The main effect of thisapproach is that, in comparison to conventional independent scalarquantization as used in HEVC, the admissible reconstruction vectors arepacked denser in the N-dimensional vector space (N represents the numberof transform coefficients in a transform block). That means, for a givenaverage number of admissible reconstruction vectors per N-dimensionalunit volume, the average distortion between an input vector and theclosest reconstruction vector is reduced. The approach of dependentscalar quantization is realized by: (a) defining two scalar quantizerswith different reconstruction levels and (b) defining a process forswitching between the two scalar quantizers.

FIG. 4 is an illustration of the two scalar quantizers used in theproposed approach of dependent quantization.

The two scalar quantizers used, denoted by Q0 and Q1, are illustrated inFIG. 4. The location of the available reconstruction levels is uniquelyspecified by a quantization step size A. The scalar quantizer used (Q0or Q1) is not explicitly signalled in the bitstream. Instead, thequantizer used for a current transform coefficient is determined by theparities of the transform coefficient levels that precede the currenttransform coefficient in coding/reconstruction order.

As illustrated in FIG. 5, the switching between the two scalarquantizers (Q0 and Q1) is realized via a state machine with four states.The state can take four different values: 0, 1, 2, 3. It is uniquelydetermined by the parities of the transform coefficient levels precedingthe current transform coefficient in coding/reconstruction order. At thestart of the inverse quantization for a transform block, the state isset equal to 0. The transform coefficients are reconstructed in scanningorder (i.e., in the same order they are entropy decoded). After acurrent transform coefficient is reconstructed, the state is updated asshown in FIG. 5, where k denotes the value of the transform coefficientlevel.

2.5.4. User-Defined Quantization Matrix in JVET-N0847

In this contribution, it is proposed to add support for signalling thedefault and user-defined scaling matrices on top of VTM4.0. The proposalis conforming to the bigger size range for the blocks (from 4×4 to 64×64for luma, from 2×2 to 32×32 for chroma), rectangular TBs, dependentquantization, multiple transform selection (MTS), large transform withzeroing-out high frequency coefficients (aligned to the one-stepdefinition procedure of scaling matrices for TBs), intra subblockpartitioning (ISP), and intra block copy (IBC, also known as currentpicture referencing, CPR).

It is proposed to add syntax to support signaling of default anduser-defined scaling matrices on top of VTM4.0 conforming to following:

-   -   three modes for scaling matrices: OFF, DEFAULT, and USER_DEFINED    -   bigger size range for the blocks (from 4×4 to 64×64 for luma,        2×2 to 32×32 for chroma)    -   rectangular transform blocks (TBs)    -   dependent quantization    -   multiple transform selection (MTS)    -   large transforms with zeroing-out high frequency coefficients    -   intra sub-block partitioning (ISP)    -   intra block copy (IBC, also known as current picture        referencing, CPR), share the same QMs as Intra coded blocks    -   DEFAULT scaling matrices are flat for all TB sizes, with the        default value 16    -   Scaling matrices shall NOT be applied for        -   TS for all TB sizes        -   secondary transform (a.k.a. RST)

2.5.4.1. Signaling of QM for Square Transform Sizes 2.5.4.1.1. ScanningOrder of Elements in a Scaling Matrix

The elements are coded in a scanning order which is the same as thatused for coefficient coding, i.e., diagonal scan order. An example ofthe diagonal scan order is depicted in FIGS. 6A-6B.

FIGS. 6A-6B show examples of diagonal scan orders. FIG. 6A showsscanning direction example. FIG. 6B shows coordinates and scan orderindex for each element.

The corresponding specification for this order is defined as follows:

6.5.2 Up-Right Diagonal Scan Order Array Initialization Process

Input to this process is a block width blkWidth and a block size heightblkHeight.

Output of this process is the array diagScan[sPos][sComp]. The arrayindex sPos specify the scan position ranging from 0 to(blkWidth*blkHeight)−1. The array index sComp equal to 0 specifies thehorizontal component and the array index sComp equal to 1 specifies thevertical component. Depending on the value of blkWidth and blkHeight,the array diagScan is derived as follows:

  i = 0 x = 0 y = 0 stopLoop = FALSE while( !stopLoop ) {  while( y >= 0) {   if( x < blkWidth && y < blkHeight ) { (6-11)    diagScan[ i ][ 0 ]= x    diagScan[ i ][ 1 ] = y    i++   }   y− −   x++  }  y = x  x = 0 if( i >= blkWidth * blkHeight )   stopLoop = TRUE }

2.5.4.1.2. Coding of Selective Elements

The DC values (i.e., element located at scanning index equal to 0,top-left of the matrix) are separately coded for following scalingmatrices: 16×16, 32×32, and 64×64.

For TBs (N×N) of Size Smaller than or Equal to 8×8 (N<=8)For TBs of size smaller than or equal to 8×8, all elements in onescaling matrix are signaled.For TBs (N×N) of Size Greater than 8×8 (N>8)

If the TBs have size greater than 8×8, only 64 elements in one 8×8scaling matrix are signaled as a base scaling matrix. The 64 elementsare corresponding to coordinates (m*X, m*Y) wherein m=N/8 and X, Y being[0 . . . 7]. In other words, one N×N block is split to multiple m*mnon-overlapped regions, and for each region, they share the sameelement, and this shared element is signaled.

For obtaining square matrices of size greater than 8×8, the 8×8 basescaling matrix is up-sampled (by duplication of elements) to thecorresponding square size (i.e. 16×16, 32×32, 64×64).

Taking 32×32 and 64×64 as examples, the selected positions for elementsto be signaled marked with circle. Each square represents one element.

FIG. 7 shows an example of of selected positions for QM signaling (32×32transform size).

FIG. 8 shows an example of selected positions for QM signaling (64×64transform size).

2.5.4.2. Derivation of QMs for Non-Square Transform Sizes

There is no additional signaling of QMs for non-square transform sizes.Instead, the QM for the non-square transform sizes is derived from thatfor square transform sizes. Examples are depicted in FIG. 7.

More specifically, when generating a scaling matrix for rectangular TBs,two cases are considered:

-   -   1. Height of the rectangular matrix H is greater than width W,        then scaling matrix Scaling Matrix for rectangular TB of size        W×H is defined from the reference scaling matrix of size        baseL×baseL as follows, where baseL is equal to min (log 2(H),        3):

$\begin{matrix}{{{{ScalingMatrix}( {i,j} )} = {{ScalingList}\lbrack {{{{base}L} \cdot {{int}( \frac{j}{{ratio}H} )}} + {{int}( \frac{i \cdot {{ratio}{HW}}}{{ratio}H} )}} \rbrack}}\mspace{20mu}{{{{for}\mspace{14mu} i} = {0:{W - 1}}},\mspace{20mu}{j = {0:{H - 1}}}}\mspace{20mu}{and}\mspace{20mu}{{{{ratio}H} = \frac{H}{{base}L}},\mspace{20mu}{{{ratio}{WH}} = {\frac{W}{H}.}}}} & (1)\end{matrix}$

-   -   2. Height of the rectangular matrix H is less than width W, then        scaling matrix Scaling Matrix for rectangular TB of size W×H is        defined from the reference scaling matrix of size baseL×baseL as        follows, where baseL is equal to min (log 2(W), 3):

$\begin{matrix}{{{{ScalingMatrix}( {i,j} )} = {{ScalingList}\lbrack {{{{base}L} \cdot {{int}( \frac{j + {{ratio}{WH}}}{{ratio}W} )}} + {{int}(W)}} \rbrack}}\mspace{20mu}{{{{for}\mspace{14mu} i} = {0:{W - 1}}},\mspace{20mu}{j = {0:{H - 1}}}}\mspace{20mu}{and}\mspace{20mu}{{{{ratio}W} = \frac{W}{{base}L}},\mspace{20mu}{{{ratio}{WH}} = {\frac{W}{H}.}}}} & (2)\end{matrix}$

Here int(x) is modifying value of x by truncating the fractional part.

FIG. 8 shows examples of QM derivation for non-square blocks from squareblocks. (a) QM of 2×8 block derived from the 8×8 block, (b) QM of 8×2block derived from that 8×8 block,

2.5.4.3. Signaling of QM for Transform Blocks with Zeroing-Out

In addition, when the zeroing-out of the high frequency coefficients for64-point transform is applied, corresponding high frequencies of thescaling matrices are also zeroed out. That is, if the width or height ofthe TB is greater than or equal to 32, only left or top half of thecoefficients is kept, and the remaining coefficients are assigned tozero, as shown in FIG. 9. For this, a check is performed when obtainingrectangular matrices according to equations (1) and (2) andcorresponding elements in ScalingMatrix(i,j) are assigned to 0.

2.5.4.4. Syntax, semantics for quantization matrix

The Same Syntax Elements as that in HEVC are Added to SPS and PPS.However, the signaling of scaling_list_data syntax is changed:

7.3.2.11 Scaling List Data Syntax

Descriptor scaling_list_data( ) {  for( sizeId = 1; sizeId < 7; sizeId++)   for( matrixId = 0; matrixId < 6; matrixId ++ ) {    if( ! ( ((sizeId == 1 ) && ( matrixId % 3 == 0 ) ) || ((    sizeId == 6 ) && (matrixId % 3 != 0 ) )) ) {     scaling_list_pred_mode_flag[ sizeId ][matrixId ] u(1)     if( !scaling_list_pred_mode_flag[ sizeId ][    matrixId ] )      scaling_list_pred_matrix_id_delta[ sizeId ][ ue(v)     matrixId ]     else {      nextCoef = 8      coefNum = Min( 64, ( 1<< ( sizeId << 1 ) ) )      if( sizeId > 3 ) {      scaling_list_dc_coef_minus8[ sizeId − 4 ][ se(v)       matrixId ]      nextCoef = scaling_list_dc_coef_minus8[ sizeId − 4 ][ matrixId ] +8      }      for( i = 0; i < coef Num; i++ ) {         x =DiagScanOrder[ 3 ][ 3 ][ i ][ 0 ]         y = DiagScanOrder[ 3 ][ 3 ][ i][ 1 ]         if ( !(sizeId==6 && x>=4 && y>=4) ) {        scaling_list_delta_coef se(v)        nextCoef = ( nextCoef +       scaling_list_delta_coef + 256) % 256        ScalingList[ sizeId][ matrixId ][ i ] =        nextCoef        }      }     }    }   }  } }

7.4.3.11 Scaling List Data Semantics

scaling_list_pred_mode_flag[sizeId][matrixId] equal to 0 specifies thatthe values of the scaling list are the same as the values of a referencescaling list. The reference scaling list is specified byscaling_list_pred_matrix_id_delta[sizeId][matrixId].scaling_list_pred_mode_flag[sizeId][matrixId] equal to 1 specifies thatthe values of the scaling list are explicitly signalled.scaling_list_pred_matrix_id_delta[sizeId][matrixId] specifies thereference scaling list used to derive ScalingList[sizeId][matrixId], thederivation of ScalingList[sizeId][matrixId] is bad onscaling_list_pred_matrix_id_delta[sizeId][matrixId] as follows:

-   -   If scaling_list_pred_matrix_id_delta[sizeId][matrixId] is equal        to 0, the scaling list is inferred from the default scaling list        ScalingList[sizeId][matrixId][i] as specified in Table 7-15,        Table 7-16, Table 7-17, Table 7-18 for i=0 . . . Min(63,        (1<<(sizeId<<1))−1).    -   Otherwise, the scaling list is inferred from the reference        scaling list as follows:        -   For sizeId=1 . . . 6,

refMatrixId=matrixId−scaling_list_pred_matrix_id_delta[sizeId][matrixId]*(sizeId==6?3:1)  (7-XX)

If sizeId is equal to 1, the value of refMatrixId shall not be equal to0 or 3. Otherwise, if sizeId is less than or equal to 5, the value ofscaling_list_pred_matrix_id_delta[sizeId][matrixId] shall be in therange of 0 to matrixId, inclusive. Otherwise (sizeId is equal to 6), thevalue of scaling_list_pred_matrix_id_delta[sizeId][matrixId] shall be inthe range of 0 to matrixId/3, inclusive.

TABLE 7-13 Specification of sizeId Size of quantization matrix sizeId 1× 1 0 2 × 2 1 4 × 4 2 8 × 8 3 16 × 16 4 32 × 32 5 64 × 64 6

TABLE 7-14 Specification of matrixId according to sizeId, predictionmode and colour component cIdx (Colour sizeId CuPredMode component)matrixId 2, 3, 4, 5, 6 MODE_INTRA 0 (Y) 0 1, 2, 3, 4, 5 MODE_INTRA 1(Cb) 1 1, 2, 3, 4, 5 MODE_INTRA 2 (Cr) 2 2, 3, 4, 5, 6 MODE_INTER 0 (Y)3 1, 2, 3, 4, 5 MODE_INTER 1 (Cb) 4 1, 2, 3, 4, 5 MODE_INTER 2 (Cr) 5 2,3, 4, 5, 6 MODE_IBC 0 (Y) 0 1, 2, 3, 4, 5 MODE_IBC 1 (Cb) 1 1, 2, 3, 4,5 MODE_IBC 2 (Cr) 2scaling_list_dc_coef_minus8[sizeId][matrixId] plus 8 specifies the valueof the variable ScalingFactor[4][matrixId][0][0] for the scaling listfor the 16×16 size when sizeId is equal to 4 and specifies the value ofScalingFactor[5][matrixId][0][0] for the scaling list for the 32×32 sizewhen sizeId is equal to 5, and specifies the value ofScalingFactor[6][matrixId][0][0] for the scaling list for the 64×64 sizewhen sizeId is equal to 6. The value ofscaling_list_dc_coef_minus8[sizeId][matrixId] shall be in the range of−7 to 247, inclusive.When scaling_list_pred_mode_flag[sizeId][matrixId] is equal to 0,scaling_list_pred_matrix_id_delta[sizeId][matrixId] is equal to 0 andsizeId is greater than 3, the value ofscaling_list_dc_coef_minus8[sizeId][matrixId] is inferred to be equal to8.When scaling_list_pred_matrix_id_delta[sizeId][matrixId] is not equal to0 and sizeId is greater than 3, the value ofscaling_list_dc_coef_minus8[sizeId][matrixId] is inferred to be equal toscaling_list_dc_coef_minus8[sizeId][refMatrixId], where the value ofrefMatrixId is given by Equation 7-XXscaling_list_delta_coef specifies the difference between the currentmatrix coefficient ScalingList[sizeId][matrixId][i] and the previousmatrix coefficient ScalingList[sizeId][matrixId][i−1], whenscaling_list_pred_mode_flag[sizeId][matrixId] is equal to 1. The valueof scaling_list_delta_coef shall be in the range of −128 to 127,inclusive. The value of ScalingList[sizeId][matrixId][i] shall begreater than 0. When scaling_list_pred_mode_flag[sizeId][matrixId] isequal to 1 and scaling_list_delta_coef is not present, the value ofScalingList[sizeId][matrixId][i] is inferred to be 0.

TABLE 7-15 Specification of default values of ScalingList[ 1 ][ matrixId][ i ] with i = 0..3 i 0 1 2 3 ScalingList[ 1 ][1,2,4,5 ][ i ] 1 1 1 1 66 6 6

TABLE 7-16 Specification of default values of ScalingList[ 2 ][ matrixId][ i ] with i = 0..15 i 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 0 1 2 3 4 5ScalingList[ 2 ][ 0..5 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 6 6 6 66 6 6 6 6 6 6 6 6 6 6

TABLE 7-17 Specification of default values of ScalingList[ 3..6 ][matrixId ][ i ] with i = 0..63 i 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 1 23 4 ScalingList[ 3..5 ][ 0..5 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 66 6 6 6 6 6 6 6 6 6 6 6 6 6 i - 16 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 12 3 4 ScalingList[ 3..5 ][ 0..5 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 166 6 6 6 6 6 6 6 6 6 6 6 6 6 6 i - 32 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 01 2 3 4 ScalingList[ 3..5 ][ 0..5 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 116 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 i - 48 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 150 1 2 3 4 ScalingList[ 3..5 ][ 0..5 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 116 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6

TABLE 7-18 Specification of default values of ScalingList[ 6 ][ matrixId][ i ] with i = 0..63 i 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 1 2 3 4ScalingList[ 6 ][ 0, 3 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 6 6 6 6 66 6 6 6 6 6 6 6 6 6 i - 16 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 1 2 3 4ScalingList[ 6 ][ 0, 3 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 6 6 6 6 66 6 6 6 6 6 6 6 6 6 i - 32 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 1 2 3 4ScalingList[ 6 ][ 0, 3 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 6 6 6 6 66 6 6 6 6 6 6 6 6 6 i - 48 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 0 1 2 3 4ScalingList[ 6 ][ 0, 3 ][ i ] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 6 6 6 6 66 6 6 6 6 6 6 6 6 6The five-dimensional arrayScalingFactor[sizeId][sizeId][matrixId][x][y], with x, y=0 . . .(1<<sizeId)−1, specifies the array of scaling factors according to thevariables sizeId specified in Table 7-13 and matrixId specified in Table7-14.The elements of the quantization matrix of size 2×2,ScalingFactor[1][matrixId][ ][ ], are derived as follows:

ScalingFactor[1][1][matrixId][x][y]=ScalingList[1][matrixId][i]  (7-XX)

with i=0 . . . 3, matrixId=1, 2, 4, 5, x=DiagScanOrder[1][1][i][0], andy=DiagScanOrder[1][1][i][1]

The elements of the quantization matrix of size 4×4,ScalingFactor[2][matrixId][ ][ ], are derived as follows:

ScalingFactor[2][2][matrixId][x][y]=ScalingList[2][matrixId][i]  (7-XX)

with i=0 . . . 15, matrixId=0 . . . 5, x=DiagScanOrder[2][2][i][0], andy=DiagScanOrder[2][2][i][1]

The elements of the quantization matrix of size 8×8,ScalingFactor[3][matrixId][ ][ ], are derived as follows:

ScalingFactor[3][3][matrixId][x][y]=ScalingList[3][matrixId][i]  (7-XX)

with i=0 . . . 63, matrixId=0 . . . 5, x=DiagScanOrder[3][3][i][0], andy=DiagScanOrder[3][3][i][1]

The elements of the quantization matrix of size 16×16,ScalingFactor[4][matrixId][ ][ ], are derived as follows:

ScalingFactor[4][4][matrixId][x*2+k][y*2+j]=ScalingList[4][matrixId][i]  (7-XX)

with i=0 . . . 63, j=0 . . . 1, k=0 . . . 1, matrixId=0 . . . 5,x=DiagScanOrder[3][3][i][0],

and y=DiagScanOrder[3][3][i][1]

ScalingFactor[4][4][matrixId][0][0]=scaling_list_dc_coef_minus8[0][matrixId]+8  (7-XX)

with matrixId=0 . . . 5

The elements of the quantization matrix of size 32×32,ScalingFactor[5][matrixId][ ][ ], are derived as follows:

ScalingFactor[5][5][matrixId][x*4+k][y*4+j]=ScalingList[5][matrixId][i]  (7-XX)

with i=0 . . . 63, j=0 . . . 3, k=0 . . . 3, matrixId=0 . . . 5,x=DiagScanOrder[3][3][i][0],

and y=DiagScanOrder[3][3][i][1]

ScalingFactor[5][5][matrixId][0][0]=scaling_list_dc_coef_minus8[1][matrixId]+8  (7-XX)

with matrixId=0 . . . 5

The elements of the quantization matrix of size 64×64,ScalingFactor[6][matrixId][ ][ ], are derived as follows:

ScalingFactor[6][6][matrixId][x*8+k][y*8+j]=ScalingList[6][matrixId][i]  (7-XX)

with i=0 . . . 63, j=0 . . . 7, k=0 . . . 7, matrixId=0, 3,x=DiagScanOrder[3][3][i][0],

and y=DiagScanOrder[3][3][i][1]

ScalingFactor[6][6][matrixId][0][0]=scaling_list_dc_coef_minus8[2][matrixId]+8  (7-XX)

with matrixId=0, 3

When ChromaArrayType is equal to 3, the elements of the chromaquantization matrix of size 64×64, ScalingFactor[6][6][matrixId][ ][ ],with matrixId=1, 2, 4 and 5 are derived as follows:

ScalingFactor[6][6][matrixId][x*8+k][y*8+j]=ScalingList[5][matrixId][i]  (7-XX)

with i=0 . . . 63, j=0 . . . 7, k=0 . . . 7,x=DiagScanOrder[3][3][i][0], and y=DiagScanOrder[3][3][i][1]

ScalingFactor[6][6][matrixId][0][0]=scaling_list_dc_coef_minus8[1][matrixId]+8  (7-XX)

//non-square casesFor a quantization matrix with rectangular size,The five-dimensional arrayScalingFactor[sizeId][sizeIdH][matrixId][x][y], with x=0 . . .(1<<sizeIdW)−1, y=0 . . . (1<<sizeIdH)−1, sizeIdW!=sizeIdH, specifiesthe array of scaling factors according to the variables sizeIdW andsizeIdH specified in Table 7-19, are derived as follows:ScalingFactor[sizeIdW][sizeIdH][matrixId][x][y] can be generated byScalingList[sizeLId][matrixId][i]with sizeLId=max(sizeIdW, sizeIdH), sizeIdW=0, 1 . . . 6, sizeIdH=0, 1 .. . 6, matrixId=0 . . . 5, x=0 . . . (1<<sizeIdW)−1, y=0 . . .(1<<sizeIdH)−1, x=DiagScanOrder[k][k][i][0], andy=DiagScanOrder[k][k][i][1], k=min(sizeLId, 3), andratioW=(1<<sizeIdW)/(1<<k), ratioH=(1<<sizeIdH)/(1<<k), andratioWH=(1<<abs(sizeIdW−sizeIdH)), as the following rules:

-   -   If (sizeIdW>sizeIdH)

ScalingFactor[sizeIdW][sizeIdH][matrixId][x][y]=ScalingList[sizeLId][matrixId][Raster2Diag[(1<<k)*((y*ratioWH)/ratioW)+x/ratioW]]

-   -   else

ScalingFactor[sizeIdW][sizeIdH][matrixId][x][y]=ScalingList[sizeLId][matrixId][Raster2Diag[(1<<k)*(y/ratioH)+(x*ratioWH)/ratioH]],

-   -   Where Raster2Diag[ ] is the function converting raster scan        position in one 8×8 block to diagonal scan position        //zeroing-out cases        A quantization matrix with rectangular size shall be zeroed out        for the samples satisfying to the following conditions    -   x>32    -   y>32    -   the decoded tu is not coded by default transform mode,        (1<<sizeIdW)==32 and x>16    -   the decoded tu is not coded by default transform mode,        (1<<sizeIdH)==32 and y>16

TABLE 7-19 Specification of sizeIdW and sizeIdH Size of quantizationmatrix sizeIdW sizeIdH 1 0 0 2 1 1 4 2 2 8 3 3 16 4 4 32 5 5 64 6 6

2.6 Quantized Residual Block Differential Pulse-Code Modulation

In JVET-M0413, a quantized residual block differential pulse-codemodulation (QR-BDPCM) is proposed to code screen contents efficiently.

The prediction directions used in QR-BDPCM can be vertical andhorizontal prediction modes. The intra prediction is done on the entireblock by sample copying in prediction direction (horizontal or verticalprediction) similar to intra prediction. The residual is quantized andthe delta between the quantized residual and its predictor (horizontalor vertical) quantized value is coded. This can be described by thefollowing: Fora block of size M (rows)×N (cols), let r_(i,j), 0≤i≤M−1,0≤j≤N−1 be the prediction residual after performing intra predictionhorizontally (copying left neighbor pixel value across the the predictedblock line by line) or vertically (copying top neighbor line to eachline in the predicted block) using unfiltered samples from above or leftblock boundary samples. Let Q(r_(i,j)), 0≤i≤M−1, 0≤j≤N−1 denote thequantized version of the residual r_(i,j), where residual is differencebetween original block and the predicted block values. Then the blockDPCM is applied to the quantized residual samples, resulting in modifiedM×N array {tilde over (R)} with elements r_(i,j). When vertical BDPCM issignalled:

$\begin{matrix}{{\overset{\sim}{r}}_{i,j} = \{ \begin{matrix}{{Q( r_{i,j} )},} & {{i = 0},} & {0 \leq j \leq ( {N - 1} )} \\{{{Q( r_{i,j} )} - {Q( r_{{({i - 1})},j} )}},} & {{1 \leq i \leq ( {M - 1} )},} & {0 \leq j \leq ( {N - 1} )}\end{matrix} } & ( {2\text{-}7\text{-}1} )\end{matrix}$

For horizontal prediction, similar rules apply, and the residualquantized samples are obtained by

$\begin{matrix}{{\overset{\sim}{r}}_{i,j} = \{ \begin{matrix}{{Q( r_{i,j} )},} & {{0 \leq i \leq ( {M - 1} )},} & {j = 0} \\{{{Q( r_{i,j} )} - {Q( r_{i,{({j - 1})}} )}},} & {{0 \leq i \leq ( {M - 1} )},} & {1 \leq j \leq ( {N - 1} )}\end{matrix} } & ( {2\text{-}7\text{-}2} )\end{matrix}$

The residual quantized samples {tilde over (r)}_(i,j) are sent to thedecoder.

On the decoder side, the above calculations are reversed to produceQ(r_(i,j)), 0≤i≤M−1, 0≤j≤N−1. For vertical prediction case,

Q(r _(i,j))=Σ_(k=0) ^(i) {tilde over (r)}_(k,j),0≤i≤(M−1),0≤j≤(N−1)  (2-7-3)

For horizontal case,

Q(r _(i,j))=Σ_(k=0) ^(j) {tilde over (r)}_(i,k),0≤i≤(M−1),0≤j≤(N−1)  (2-7-4)

The inverse quantized residuals, Q⁻¹ (Q(r_(i,j))), are added to theintra block prediction values to produce the reconstructed samplevalues.

The main benefit of this scheme is that the inverse DPCM can be done onthe fly during coefficient parsing simply adding the predictor as thecoefficients are parsed or it can be performed after parsing.

The draft text changes of QR-BDPCM are shown as follows.

7.3.6.5 Coding Unit Syntax

Descriptor coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {  if(tile_group_type != I | | sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA )    cu_skip_flag[ x0 ][ y0 ] ae(v)   if( cu_skip_flag[x0 ][ y0 ] = = 0 &&   tile_group_type != I )    pred_mode_flag ae(v)  if( ( ( tile_group_type = = I && cu_skip_flag[ x0 ][   y0 ] = =0 ) | |   ( tile_group_type != I && CuPredMode[ x0 ][    y0 ] != MODE_INTRA ) )&&    sps_ibc_enabled_flag )    pred_mode_ibc_flag ae(v)  }  if(CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {   if( pred_mode_flag = =MODE_INTRA && (   cIdx == 0 ) &&    ( cbWidth <= 32) && ( CbHeight <= 32)) {    bdpcm_flag[ x0 ][ y0 ] ae(v)    if( bdpcm_flag[ x0 ][ y0 ] ) {    bdpcm_dir_flag[ x0 ][ y0 ] ae(v)    }    else {   if(sps_pcm_enabled_flag &&    cbWidth >= MinIpcmCbSizeY && cbWidth <=   MaxIpcmCbSizeY &&    cbHeight >= MinIpcmCbSizeY && cbHeight <=   MaxIpcmCbSizeY )    pcm_flag[ x0 ][ y0 ] ae(v)   if( pcm_flag[ x0 ][y0 ] ) {    while( !byte_aligned( ) )     pcm_alignment_zero_bit f(1)   pcm_sample( cbWidth, cbHeight, treeType)   } else {    if( treeType == SINGLE_TREE | | treeType = =    DUAL_TREE_LUMA ) {     if( ( y0 %CtbSizeY ) > 0 )      intra_luma_ref_idx[ x0 ][ y0 ] ae(v)     if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 &&      ( cbWidth <= MaxTbSizeY || cbHeight <=      MaxTbSizeY ) &&      ( cbWidth * cbHeight >MinTbSizeY *      MinTbSizeY ))      intra_subpartitions_mode_flag[ x0][ y0 ] ae(v)     if( intra_subpartitions_mode_flag[ x0 ][     y0 ] = =1 &&      cbWidth <= MaxTbSizeY && cbHeight <=      MaxTbSizeY )     intra_subpartitions_split_flag[ x0 ][ y0 ] ae(v)     if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 &&     intra_subpartitions_mode_flag[ x0 ][      y0 ] = = 0 )     intra_luma_mpm_flag[ x0 ][ y0 ] ae(v)     if( intra_luma_mpm_flag[x0 ][ y0 ] )      intra_luma_mpm_idx[ x0 ][ y0 ] ae(v)     else     intra_luma_mpm_remainder[ x0 ][ y0 ] ae(v)    }    }    if(treeType = = SINGLE_TREE | | treeType = =    DUAL_TREE_CHROMA )    intra_chroma_pred_mode[ x0 ][ y0 ] ae(v)   }  } else if( treeType !=DUAL_TREE_CHROMA ) { /* MODE_INTER or MODE_IBC */ ... }bdpcm_flag[x0][y0] equal to 1 specifies that a bdpcm_dir_flag is presentin the coding unit including the luma coding block at the location (x0,y0)bdpcm_dir_flag[x0][y0] equal to 0 specifies that the predictiondirection to be used in a bdpcm block is horizontal, otherwise it isvertical.

3. EXAMPLE TECHNICAL PROBLEMS SOLVED BY EMBODIMENTS AND TECHNIQUES

The current VVC design has the following problems in terms ofquantization matrices:

-   -   1. For QR-BDPCM and BDPCM-blocks, transform is not applied.        Therefore, applying scaling matrix to such blocks in a similar        way as other transform-applied blocks is not optimal.    -   2. IBC and intra coding modes share the same scaling matrices.        However, IBC is more likely an inter coding tool. Such a design        seems to be not reasonable.    -   3. For larger blocks with zeroing-out, several elements are        signaled, but reset to zero in the decoding process which wastes        bits.    -   4. In some frameworks, quantization is performed as always        applying quantization matrices. Thus, quantization matrices for        small block may lead to frequent matrices changed.

4. A LISTING OF EMBODIMENTS AND TECHNIQUES

The detailed inventions below should be considered as examples toexplain general concepts. These inventions should not be interpreted ina narrow way. Furthermore, these inventions can be combined in anymanner.

-   -   1. When the transform skip (TS) flag is not signaled in the bit        stream, how to set the value of this flag may depend on coded        mode information.        -   a. In one example, for BDPCM/QR-BDPCM coded blocks, the TS            flag is inferred to be 1.        -   b. In one example, for non-BDPCM/QR-BDPCM coded blocks, the            TS flag is inferred to be 0.    -   2. It is proposed that scaling matrix may be applied on        BDPCM/QR-BDPCM coded blocks.        -   a. Alternatively, it is proposed to disallow scaling matrix            for BDPCM/QR-BDPCM coded blocks.        -   b. In one example, how to select scaling matrix for            BDPCM/QR-BDPCM coded blocks may be performed in the same way            as transform skip coded blocks.        -   c. In one example, how to select the scaling matrix for a            BDPCM/QR-BDPCM coded block may depend on whether one or            multiple transforms are applied to the block.            -   i. In one example, if one or multiple transforms are                applied to a BDPCM/QR-BDPCM coded block, the scaling                matrix may be allowed.            -   ii. In one example, if one or multiple transforms are                applied to a BDPCM/QR-BDPCM coded block, how to select                the scaling matrix for BDPCM/QR-BDPCM coded blocks may                be performed in the same way as an intra coded block.    -   3. Whether to and/or how to filter samples/edges between two        adjacent blocks in in-loop filters (de-blocking filters) and/or        other post-reconstruction filters may depend on whether any or        both two adjacent blocks are coded with transform skip (TS)        mode.        -   a. Whether to and/or how to filter samples/edges between two            adjacent blocks in in-loop filters (de-blocking filters)            and/or other post-reconstruction filters may depend on            whether two adjacent blocks coded with TS, BDPCM, QR-BDPCM,            palette mode.        -   b. In one example, the derivation of boundary filtering            strength may depend on the TS mode flag(s) of one or both of            the two adjacent blocks.        -   c. In one example, for the samples located at the TS-coded            blocks, deblocking filter/Sample adaptive Offset/adaptive            loop filter/other kinds of in-loop filters/other            post-reconstruction filters may be disabled.            -   i. In one example, if two adjacent blocks are both coded                with transform skipped mode, there is no need to filter                such an edge between these two.            -   ii. In one example, if one of two adjacent blocks is                coded with transform skipped mode and the other one is                not, there is no need to filter samples located at the                TS-coded block.        -   d. Alternatively, for the samples located at the TS-coded            blocks, a different filter (e.g., smoother filter) may be            allowed.        -   e. During the process of in-loop filters (e.g., de-blocking            filters) and/or other post-reconstruction filters (e.g.,            bilateral filter, diffusion filter), a block coded with            PCM/BDPCM/QR-BDPCM and/or other kinds of modes which            transform are not applied on, may be treated in the same way            as coded with TS mode, such as mentioned above.    -   4. Blocks coded with IBC and inter coding modes may share the        same scaling matrices.    -   5. Scaling matrix selection may depend on the transform matrix        type.        -   a. In one example, selection of scaling matrices may depend            on whether the block uses a default transform such as DCT2            or not.        -   b. In one example, scaling matrices may be signaled for            multiple transform matrix types separately.    -   6. Scaling matrix selection may depend on the motion information        of a block.        -   a. In one example, scaling matrix selection may depend on            whether the block is coded with a sub-block coding mode            (such as affine mode) or not.        -   b. In one example, scaling matrices may be signaled for            affine and non-affine modes separately.        -   c. In one example, scaling matrix selection may depend on            the block is coded with affine intra prediction mode or not.    -   7. Instead of disabling scaling matrices for secondary transform        coded blocks, it is proposed to enable scaling matrices. Suppose        the transform block size is denoted by K×L, and secondary        transform is applied to the top-left M×N block.        -   a. Scaling matrices may be signaled in tile group            header/slice header/PPS/VPS/SPS for secondary transform            or/and reduced secondary transform or/and rotation            transform.        -   b. In one example, scaling matrices may be selected            according to whether secondary transform is applied or not.            -   i. In one example, elements of a scaling matrix for the                top-left M×N block may be signaled separately for the                secondary transform is applied or not        -   c. Alternatively, furthermore, scaling matrices may be only            applicable to regions which secondary transform is not            applied.        -   d. In one example, the remaining part except the top-left            M×N region could still apply scaling matrices.        -   e. Alternatively, scaling matrices may be only applicable to            regions where secondary transform is applied.    -   8. Instead of deriving scaling matrices for non-square blocks        from square blocks, it is proposed to signal scaling matrices        for non-square blocks.        -   a. In one example, scaling matrices for non-square blocks            may be coded with prediction from square blocks may be            enabled.    -   9. It is proposed to disable usage of scaling matrix for some        positions and enable usage of scaling matrix for remaining        positions within a block.        -   a. For example, fora block contains more than M*N positions,            only the top-left M*N region may use scaling matrices.        -   b. For example, fora block contains more than M*N positions,            only the top M*N positions may use scaling matrices.        -   c. For example, for a block contains more than M*N            positions, only the left M*N positions may use scaling            matrices.    -   10. How many elements in a scaling matrix to be signaled may be        dependent on whether zeroing-out is applied.        -   a. In one example, for the 64×64 transform, suppose only the            top-left M×N transform coefficients are kept and all the            remaining coefficients are zeroing-out. Then the number of            elements to be signaled may be derived as M/8*N/8.    -   11. For transforms with zeroing-out, it is proposed to disable        signaling of elements in a scaling matrix located at the        zeroing-out region. Suppose for the K×L transform, only the        top-left M×N transform coefficients are kept and all the        remaining coefficients are zeroing-out.        -   a. In one example, K=L=64, and M=N=32.        -   b. In one example, signaling of the elements in a scaling            matrix corresponding to locations outside of the top-left            M×N region are skipped.    -    FIG. 10 shows an example of only selected elements in the        dashed region (e.g., the M×N region) are signaled.        -   c. In one example, the sub-sampling ratio for selecting            elements in a scaling matrix may be determined by K and/or            L.            -   i. For example, the transform block is split to multiple                sub-regions and each sub-region size is Uw*Uh. One                element located within each sub-region of the top-left                M×N region may be signaled.            -   ii. Alternatively, furthermore, how many elements to be                coded may depend on the M and/or N.                -   1) In one example, how many elements to be coded for                    such K×L transforms with zeroing-out is different                    from that for a M×N transform block without                    zeroing-out.        -   d. In one example, the sub-sampling ratio for selecting            elements in a scaling matrix may be determined by M and/or N            instead of K and L.            -   i. For example, the M×N region is split to multiple                sub-regions. One element within each (M/Uw, N/Uh) region                may be signaled.            -   ii. Alternatively, furthermore, how many elements to be                coded for such K×L transforms with zeroing-out is the                same as that for a M×N transform block without                zeroing-out.        -   e. In one example, K=L=64, M=N=32, Uw=Uh=8.    -   12. It is proposed to use only one quantization matrix for        certain block sizes, such as for small size blocks.        -   a. In one example, all blocks smaller than W×H, regardless            of block type, may not be allowed to use two or more            quantization matrices.        -   b. In one example, all blocks with width smaller than a            threshold, may not be allowed to use two or more            quantization matrices.        -   c. In one example, all blocks with height smaller than a            threshold, may not be allowed to use two or more            quantization matrices.        -   d. In one example, quantization matrix may be not applied            for small size blocks.    -   13. The above bullets may be applicable to other coding methods        that do not apply transform (or do not apply Identity        transform).        -   a. In one example, the above bullets may be applicable to            palette mode coded blocks by replacing TS/BDPCM/QR-BDPCM′ by            ‘Palette’.

5. EMBODIMENTS 5.1. Embodiment #1 on Deblocking Filter

The changes on top of VVC working draft version 5 are highlighted inbold italicized text. One or multiple of highlighted conditions may beadded.

8.8.2 Deblocking Filter Process 8.8.2.1 General

Inputs to this process are the reconstructed picture prior todeblocking, i.e., the array recPicture_(L) and, when ChromaArrayType isnot equal to 0, the arrays recPicture_(Cb) and recPicture_(Cr).Outputs of this process are the modified reconstructed picture afterdeblocking, i.e., the array recPicture_(L) and, when ChromaArrayType isnot equal to 0, the arrays recPicture_(Cb) and recPicture_(Cr).The vertical edges in a picture are filtered first. Then the horizontaledges in a picture are filtered with samples modified by the verticaledge filtering process as input. The vertical and horizontal edges inthe CTBs of each CTU are processed separately on a coding unit basis.The vertical edges of the coding blocks in a coding unit are filteredstarting with the edge on the left-hand side of the coding blocksproceeding through the edges towards the right-hand side of the codingblocks in their geometrical order. The horizontal edges of the codingblocks in a coding unit are filtered starting with the edge on the topof the coding blocks proceeding through the edges towards the bottom ofthe coding blocks in their geometrical order.NOTE—Although the filtering process is specified on a picture basis inthis Specification, the filtering process can be implemented on a codingunit basis with an equivalent result, provided the decoder properlyaccounts for the processing dependency order so as to produce the sameoutput values.The deblocking filter process is applied to all coding subblock edgesand transform block edges of a picture, except the following types ofedges:

-   -   Edges that are at the boundary of the picture,    -   Edges that coincide with the virtual boundaries of the picture        when pps_loop_filter_across_virtual_boundaries_disabled_flag is        equal to 1,    -   Edges that coincide with brick boundaries when        loop_filter_across_bricks_enabled_flag is equal to 0,    -   Edges that coincide with upper or left boundaries of slices with        slice_loop_filter_across_slices_enabled_flag equal to 0 or        slice_deblocking_filter_disabled_flag equal to 1,    -   Edges within slices with slice_deblocking_filter_disabled_flag        equal to 1,    -   Edges that do not correspond to 8×8 sample grid boundaries of        the considered component,    -   Edges within chroma components for which both sides of the edge        use inter prediction,    -   Edges of chroma transform blocks that are not edges of the        associated transform unit.    -   Edges across the luma transform blocks of a coding unit that has        an IntraSubPartitionsSplit value not equal to ISP_NO_SPLIT.    -   Edges is between two transform skip coded blocks.    -   Edges is between one transform skip coded block and one PCM        coded block.    -   Edges is between one transform skip coded block and one QR-BDPCM        coded block.    -   Edges is between one transform skip coded block and one BDPCM        coded block.    -   Edges is between one PCM coded block and one QR-BDPCM coded        block.

5.2. Embodiment #2 on Scaling Matrix

This section provides an example of bullet 11.d in section 4.

The changes on top of JVET-N0847 are highlighted in bold italicized textand removed text are marked with strikethrough. One or multiple ofhighlighted conditions may be added.

The elements of the quantization matrix of size 64×64,ScalingFactor[6][matrixId][ ][ ], are derived as follows:

ScalingFactor[6][6][matrixId][x*4+k][y*4+j]=ScalingList[6][matrixId][i]  (7-XX)

with i=0 . . . 63, j=0 . . . 3, k=0 . . . 3, matrixId=0, 3,x=DiagScanOrder[3][3][i][0],

and y=DiagScanOrder[3][3][i][1]

In addition,

ScalingFactor[6][6][matrixId][x][y]=0   (7-xx)

with x>=32∥y>=32

ScalingFactor[6][6][matrixId][0][0]=scaling_list_dc_coef_minus8[2][matrixId]+8  (7-XX)

with matrixId=0, 3

//zeroing-out casesA quantization matrix with rectangular size shall be zeroed out for thesamples satisfying to the following conditions

-   -   the decoded tu is not coded by default transform mode,        (1<<sizeIdW)==32 and x>16    -   the decoded tu is not coded by default transform mode,        (1<<sizeIdH)==32 and y>16

5.3. Embodiment #3 on Scaling Matrix

This section provides an example of bullets 9, 11.c in section 4.The changes on top of JVET-N0847 are highlighted in bold italicized textand removed text are marked with strikethrough. One or multiple ofhighlighted conditions may be added.

7.3.2.11 Scaling List Data Syntax

Descriptor scaling_list_data( ) {  for( sizeId = 1; sizeId < 7; sizeId++)   for( matrixId = 0; matrixId < 6; matrixId ++ ) {    if( ! ( ((sizeId == 1) && ( matrixId % 3 == 0 ) )    || (( sizeId == 6 ) &&(matrixId % 3 != 0 ) )) ) {     scaling_list_pred_mode_flag[ sizeId ][u(1)     matrixId ]     if( !scaling_list_pred_mode_flag[ sizeId ][    matrixId ] )      scaling_list_pred_matrix_id_delta[ sizeId ][ ue(v)     matrixId ]     else {      nextCoef = 8      coefNum = (sizeId == 6? 16: Min( 64, (      1 << ( sizeId << 1 ) ) ) )      if( sizeId > 3 ) {      scaling_list_dc_coef_minus8[ sizeId − se(v)       4 ][ matrixId ]      nextCoef = scaling_list_dc_coef_minus8[ sizeId − 4 ][ matrixId ] +8      }      for( i = 0; i < coef Num; i++ ) {         x =DiagScanOrder[ 3 ][ 3 ][ i ][ 0 ]         y = DiagScanOrder[ 3 ][ 3 ][ i][ 1 ]         if ( !(sizeId==6 && x>=4 && y>=4) ) {        scaling_list_delta_coef se(v)        nextCoef = ( nextCoef +       scaling_list_delta_coef + 256) % 256        ScalingList[ sizeId][ matrixId ][ i ] =        nextCoef        }      }     }    }   }  } }The elements of the quantization matrix of size 64×64,ScalingFactor[6][matrixId][ ][ ], are derived as follows:

ScalingFactor[6][6][matrixId][x*8+k][y*8+j]=ScalingList[6][matrixId][i]  (7-XX)

with i=0 . . . 16, j=0 . . . 7, k=0 . . . 7, matrixId=0, 3,x=DiagScanOrder[3][3][i][0],

and y=DiagScanOrder[3][3][i][1]

In addition,

ScalingFactor[6][6][matrixId][x][y]=0   (7-xx)

with x>=32∥y>=32

ScalingFactor[6][6][matrixId][0][0]=scaling_list_dc_coef_minus8[2][matrixId]+8  (7-XX)

with matrixId=0, 3

//zeroing-out casesA quantization matrix with rectangular size shall be zeroed out for thesamples satisfying to the following conditions

-   -   the decoded tu is not coded by default transform mode,        (1<<sizeIdW)==32 and x>16    -   the decoded tu is not coded by default transform mode,        (1<<sizeIdH)==32 and y>16

5.4. Embodiment #4 on Scaling Matrix

This section provides an example of disallowing scaling matrix forQR-BDPCM coded blocks.The changes on top of JVET-N0847 are highlighted in bold italicized textand removed text are marked with strikethrough. One or multiple ofhighlighted conditions may be added.

8.7.3 Scaling Process for Transform Coefficients

Inputs to this process are:

-   -   a luma location (xTbY,yTbY) specifying the top-left sample of        the current luma transform block relative to the top-left luma        sample of the current picture,    -   a variable nTbW specifying the transform block width,    -   a variable nTbH specifying the transform block height,    -   a variable cIdx specifying the colour component of the current        block,    -   a variable bitDepth specifying the bit depth of the current        colour component.

-   Output of this process is the (nTbW)×(nTbH) array d of scaled    transform coefficients with elements d[x][y].    The quantization parameter qP is derived as follows:    -   If cIdx is equal to 0, the following applies:

qP=Qp′ _(Y)  (8-1019)

-   -   Otherwise, if cIdx is equal to 1, the following applies:

qP=Qp′ _(Cb)  (8-1020)

-   -   Otherwise (cIdx is equal to 2), the following applies:

qP=Qp′ _(Cr)  (8-1021)

The variable rectNonTsFlag is derived as follows:

rectNonTsFlag=(((Log 2(nTbW)+Log2(nTbH))&1)==1&&transform_skip_flag[xTbY][yTbY]==0)  (8-1022)

The variables bdShift, rectNorm and bdOffset are derived as follows:

bdShift=bitDepth+((rectNonTsFlag?8:0)+(Log 2(nTbW)+Log2(nTbH))/2)−5+dep_quant_enabled_flag  (8-1023)

rectNorm=rectNonTsFlag?181:1  (8-1024)

bdOffset=(1<<bdShift)>>1  (8-1025)

The list levelScale[ ] is specified as levelScale[k]={40, 45, 51, 57,64, 72} with k=0 . . . 5.For the derivation of the scaled transform coefficients d[x][y] with x=0. . . nTbW−1, y=0 . . . nTbH−1, the following applies:

-   -   The intermediate scaling factor m[x][y] is derived as follows:        -   If one or more of the following conditions are true, m[x][y]            is set equal to 16:            -   scaling_list_enabled_flag is equal to 0.            -   transform_skip_flag[xTbY][yTbY] is equal to 1.            -   bdpcm_flag[xTbY][yTbY] is equal to 1.        -   Otherwise, the following applies:

m[x][y]=ScalingFactor[sizeIdW][sizeIdH][matrixId][x][y]  (8-XXX)

Where sizeIdW is set equal to Log 2(nTbW), sizeIdH is set equal to Log2(nTbH) and matrixId is specified in Table 7-14.

-   -   The scaling factor Is[x][y] is derived as follows:        -   If dep_quant_enabled_flag is equal to 1, the following            applies:

Is[x][y]=(m[x][y]*levelScale[(qP+1)%6])<<((qP+1)/6)  (8-1026)

-   -   Otherwise (dep_quant_enabled_flag is equal to 0), the following        applies:

Is[x][y]=(m[x][y]*levelScale[qP%6])<<(qP/6)  (8-1027)

-   -   The value dnc[x][y] is derived as follows:

dnc[x][y]=(TransCoeffLevel[xTbY][yTbY][cIdx][x][y]*Is[x][y]*rectNorm+bdOffset)>>bdShift  (8-1028)

-   -   The scaled transform coefficient d[x][y] is derived as follows:

d[x][y]=Clip3(CoeffMin,CoeffMax,dnc[x][y])  (8-1029)

5.5. Embodiment #5 on Semantics of Transform Skip Flag

transform_skip_flag[x0][y0] specifies whether a transform is applied tothe luma transform block or not. The array indices x0, y0 specify thelocation (x0, y0) of the top-left luma sample of the consideredtransform block relative to the top-left luma sample of the picture.transform_skip_flag[x0][y0] equal to 1 specifies that no transform isapplied to the luma transform block. transform_skip_flag[x0][y0] equalto 0 specifies that the decision whether transform is applied to theluma transform block or not depends on other syntax elements. Whentransform_skip_flag[x0][y0] is not present and bdpcm_flag[x0][y0] isequal to 0, it is inferred to be equal to 0. Whentransform_skip_flag[x0][y0] is not present and bdpcm_flag[x0][y0] isequal to 1, it is inferred to be equal to 0.

FIG. 11 is a block diagram of a video processing apparatus 1100. Theapparatus 1100 may be used to implement one or more of the methodsdescribed herein. The apparatus 1100 may be embodied in a smartphone,tablet, computer, Internet of Things (IoT) receiver, and so on. Theapparatus 1100 may include one or more processors 1102, one or morememories 1104 and video processing hardware 1106. The processor(s) 1102may be configured to implement one or more methods described in thepresent document. The memory (memories) 1104 may be used for storingdata and code used for implementing the methods and techniques describedherein. The video processing hardware 1106 may be used to implement, inhardware circuitry, some techniques described in the present document.

The following solutions may be implemented as preferred solutions insome embodiments.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item1).

1. A method of video processing (e.g., method 1200 depicted in FIG. 12),comprising: determining (1202), fora conversion between a codedrepresentation of a video block of a video and the video block, based ona coded mode information, whether a transform skip mode is enabled forthe conversion; and performing (1204) the conversion based on thedetermining; wherein, in the transform skip mode, application of atransform to at least some coefficients representing the video block isskipped during the conversion.

2. The method of solution 1, wherein the transform skip mode isdetermined to be enabled due to the coded mode information indicating ablock differential pulse code modulation (BDPCM) or a quantized residualBDPCM (QR-BDPCM) mode.

3. The method of solution 1, wherein a flag in the coded representationindicating the transform skip mode is not parsed.

4. The method of solution 1, wherein a flag in the coded representationindicating the transform skip mode is skipped from parsing.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item2).

5. A method of video processing, comprising: determining to use ascaling matrix for a conversion between a coded representation of avideo block and the video block due to a use of a block differentialpulse code modulation (BDPCM) or a quantized residual BDPCM (QR-BDPCM)mode for the conversion; and performing the conversion using the scalingmatrix; wherein the scaling matrix is used to scale at least somecoefficients representing the video block during the conversion.

6. The method of solution 5, wherein the conversion includes applyingthe scaling matrix according to a mode that is dependent on a number oftransforms applied to the coefficients during the conversion.

7. A method of video processing, comprising: determining to disable useof a scaling matrix for a conversion between a coded representation of avideo block and the video block due to a use of a block differentialpulse code modulation (BDPCM) or a quantized residual BDPCM (QR-BDPCM)mode for the conversion; and performing the conversion using the scalingmatrix; wherein the scaling matrix is used to scale at least somecoefficients representing the video block during the conversion.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item3).

8. A method of video processing, comprising: determining, foraconversion between a coded representation of a video block of a videoand the video block, an applicability of an in-loop filter depending onwhether a transform skip mode is enabled for the conversion; andperforming the conversion based on the applicability of the in-loopfilter, wherein, in the transform skip mode, application of a transformto at least some coefficients representing the video block is skippedduring the conversion.

9. The method of solution 8, wherein the in-loop filter comprises ade-blocking filter.

10. The method of any of solutions 8-9, further including, determining astrength of the in-loop filter based on the transform skip mode of thevideo block and another transform skip mode of a neighboring block.

11. The method of any of solutions 8-9, wherein the determining includesdetermining that the in-loop filter is not applicable due to thetransform skip mode being disabled for the video block.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g.,items 4 and 5).

12. A method of video processing, comprising: selecting a scaling matrixfor a conversion between video blocks of a video and a codedrepresentation of the video blocks such that a same scaling matrix isselected for inter coding and intra block copy coding based conversion,and performing the conversion using the selected scaling matrix, whereinthe scaling matrix is used to scale at least some coefficients of thevideo blocks.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item6).

13. A method of video processing, comprising: selecting a scaling matrixfor a conversion between video blocks of a video and a codedrepresentation of the video blocks based on a transform matrix selectedfor the conversion, and performing the conversion using the selectedscaling matrix, wherein the scaling matrix is used to scale at leastsome coefficients of the video blocks and wherein the transform matrixis used to transform at least some coefficients of the video blockduring the conversion.

14. The method of solution 13, wherein the selecting the scaling matrixis based on whether the conversion of the video block uses a sub-blockcoding mode.

15. The method of solution 14, wherein the sub-block coding mode is anaffine coding mode.

16. The method of solution 15, wherein the scaling matrix for the affinecoding mode is different for another scaling matrix for another videoblock whose conversion does not use the affine coding mode.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item7).

17. A method of video processing, comprising: selecting a scaling matrixfor a conversion between video blocks of a video and a codedrepresentation of the video blocks based on a secondary transform matrixselected for the conversion, and performing the conversion using theselected scaling matrix, wherein the scaling matrix is used to scale atleast some coefficients of the video blocks and wherein the secondarytransform matrix is used to transform at least some residualcoefficients of the video block during the conversion.

18. The method of solution 17, wherein the secondary transform matrix isapplied to an M×N top left portion of the video block, and wherein thescaling matrix is applied to more than the M×N top left portion of thevideo block.

19. The method of solution 17, wherein the secondary transform matrix isapplied to an M×N top left portion of the video block, and wherein thescaling matrix is applied only to the M×N top left portion of the videoblock.

20. The method of any of solution 17-19, wherein a syntax element in thecoded representation indicates the scaling matrix.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item8).

21. A method of video processing, comprising: determining, fora videoblock that has a non-square shape, a scaling matrix for use in aconversion between the video block and a coded representation of thevideo block, wherein a syntax element in the coded representationsignals the scaling matrix; and performing the conversion based on thescaling matrix, wherein the scaling matrix is used to scale at leastsome coefficients of the video blocks during the conversion.

22. The method of solution 21, wherein the syntax element predictivelycodes the scaling matrix from a previous square block's scaling matrix.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item9).

23. A method of video processing, comprising: determining that a scalingmatrix is to be applied partially during a conversion between a codedrepresentation of a video block and the video block; and performing theconversion based by partially applying the scaling matrix such that thescaling matrix is applied in a first set of positions and disabled atremaining positions in the video block.

24. The method of solution 23, wherein the first set of positionscomprises top-left M*N positions of the video block.

25. The method of solution 23, wherein the first set of positionscomprises top M*N positions of the video block.

26. The method of solution 23, wherein the first set of positionscomprises left M*N positions of the video block.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g.,items 10 and 11).

27. A method of video processing, comprising: determining that a scalingmatrix is to be applied during a conversion between a codedrepresentation of a video block and the video block; and performing theconversion based on the scaling matrix; wherein the coded representationsignals a number of elements of the scaling matrix, wherein the numberdepends on application of coefficient zeroing out in the conversion.

28. The method of solution 27, wherein the conversion includes zeroingout all but top-left M×N positions of the video block, and wherein thenumber is M/8*N/8.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item11).

29. The method of solutions 27-28, wherein the number depends on atransform matrix used during the conversion.

30. The method of solution 29, wherein the transform matrix is of sizeK×L and wherein only top M×N coefficients are not zeroed out.

31. The method of any of solutions 27-30, wherein the scaling matrix isapplied by sub-sampling by a factor determined from K or L.

The following solutions may be implemented together with additionaltechniques described in items listed in the previous section (e.g., item12).

32. A method of video processing, comprising: determining, during aconversion between a video block and a coded representation of the videoblock, a single quantization matrix to use based on a size of the videoblock being of a specific type; and performing the conversion using thequantization matrix.

33. The method of solution 32, wherein the size of the video block issmaller than W×H, where W and H are integers.

34. The method of any of solutions 32-33, wherein a width of the videoblock is smaller than a threshold.

35. The method of any of solutions 32-33, wherein a height of the videoblock is smaller than a threshold.

36. The method of solution 32, wherein the quantization matrix is anidentity quantization matrix that does not affect quantized values.

37. The method of any of solutions 1 to 36, wherein the conversioncomprises encoding the video into the coded representation.

38. The method of any of solutions 1 to 36, wherein the conversioncomprises decoding the coded representation to generate pixel values ofthe video.

39. A video decoding apparatus comprising a processor configured toimplement a method recited in one or more of solutions 1 to 38.

40. A video encoding apparatus comprising a processor configured toimplement a method recited in one or more of solutions 1 to 38.

41. A computer program product having computer code stored thereon, thecode, when executed by a processor, causes the processor to implement amethod recited in any of solutions 1 to 38.

42. A method, apparatus or system described in the present document.

Some embodiments of the disclosed technology include making a decisionor determination to enable a video processing tool or mode. In anexample, when the video processing tool or mode is enabled, the encoderwill use or implement the tool or mode in the processing of a block ofvideo, but may not necessarily modify the resulting bitstream based onthe usage of the tool or mode. That is, a conversion from the block ofvideo to the bitstream representation of the video will use the videoprocessing tool or mode when it is enabled based on the decision ordetermination. In another example, when the video processing tool ormode is enabled, the decoder will process the bitstream with theknowledge that the bitstream has been modified based on the videoprocessing tool or mode. That is, a conversion from the bitstreamrepresentation of the video to the block of video will be performedusing the video processing tool or mode that was enabled based on thedecision or determination.

Some embodiments of the disclosed technology include making a decisionor determination to disable a video processing tool or mode. In anexample, when the video processing tool or mode is disabled, the encoderwill not use the tool or mode in the conversion of the block of video tothe bitstream representation of the video. In another example, when thevideo processing tool or mode is disabled, the decoder will process thebitstream with the knowledge that the bitstream has not been modifiedusing the video processing tool or mode that was disabled based on thedecision or determination.

FIG. 15 is a block diagram that illustrates an example video codingsystem 100 that may utilize the techniques of this disclosure. As shownin FIG. 15, video coding system 100 may include a source device 110 anda destination device 120. Source device 110 generates encoded video datawhich may be referred to as a video encoding device. Destination device120 may decode the encoded video data generated by source device 110which may be referred to as a video decoding device. Source device 110may include a video source 112, a video encoder 114, and an input/output(I/O) interface 116.

Video source 112 may include a source such as a video capture device, aninterface to receive video data from a video content provider, and/or acomputer graphics system for generating video data, or a combination ofsuch sources. The video data may comprise one or more pictures. Videoencoder 114 encodes the video data from video source 112 to generate abitstream. The bitstream may include a sequence of bits that form acoded representation of the video data. The bitstream may include codedpictures and associated data. The coded picture is a codedrepresentation of a picture. The associated data may include sequenceparameter sets, picture parameter sets, and other syntax structures. I/Ointerface 116 may include a modulator/demodulator (modem) and/or atransmitter. The encoded video data may be transmitted directly todestination device 120 via I/O interface 116 through network 130 a. Theencoded video data may also be stored onto a storage medium/server 130 bfor access by destination device 120.

Destination device 120 may include an I/O interface 126, a video decoder124, and a display device 122.

I/O interface 126 may include a receiver and/or a modem. I/O interface126 may acquire encoded video data from the source device 110 or thestorage medium/server 130 b. Video decoder 124 may decode the encodedvideo data. Display device 122 may display the decoded video data to auser. Display device 122 may be integrated with the destination device120, or may be external to destination device 120 which be configured tointerface with an external display device.

Video encoder 114 and video decoder 124 may operate according to a videocompression standard, such as the High Efficiency Video Coding (HEVC)standard, Versatile Video Coding(VVM) standard and other current and/orfurther standards.

FIG. 16 is a block diagram illustrating an example of video encoder 200,which may be video encoder 114 in the system 100 illustrated in FIG. 15.

Video encoder 200 may be configured to perform any or all of thetechniques of this disclosure. In the example of FIG. 16, video encoder200 includes a plurality of functional components. The techniquesdescribed in this disclosure may be shared among the various componentsof video encoder 200. In some examples, a processor may be configured toperform any or all of the techniques described in this disclosure.

The functional components of video encoder 200 may include a partitionunit 201, a predication unit 202 which may include a mode select unit203, a motion estimation unit 204, a motion compensation unit 205 and anintra prediction unit 206, a residual generation unit 207, a transformunit 208, a quantization unit 209, an inverse quantization unit 210, aninverse transform unit 211, a reconstruction unit 212, a buffer 213, andan entropy encoding unit 214.

In other examples, video encoder 200 may include more, fewer, ordifferent functional components. In an example, predication unit 202 mayinclude an intra block copy(IBC) unit. The IBC unit may performpredication in an IBC mode in which at least one reference picture is apicture where the current video block is located.

Furthermore, some components, such as motion estimation unit 204 andmotion compensation unit 205 may be highly integrated, but arerepresented in the example of FIG. 16 separately for purposes ofexplanation.

Partition unit 201 may partition a picture into one or more videoblocks. Video encoder 200 and video decoder 300 may support variousvideo block sizes.

Mode select unit 203 may select one of the coding modes, intra or inter,e.g., based on error results, and provide the resulting intra- orinter-coded block to a residual generation unit 207 to generate residualblock data and to a reconstruction unit 212 to reconstruct the encodedblock for use as a reference picture. In some example, Mode select unit203 may select a combination of intra and inter predication (CIIP) modein which the predication is based on an inter predication signal and anintra predication signal. Mode select unit 203 may also select aresolution fora motion vector (e.g., a sub-pixel or integer pixelprecision) for the block in the case of inter-predication.

To perform inter prediction on a current video block, motion estimationunit 204 may generate motion information for the current video block bycomparing one or more reference frames from buffer 213 to the currentvideo block. Motion compensation unit 205 may determine a predictedvideo block for the current video block based on the motion informationand decoded samples of pictures from buffer 213 other than the pictureassociated with the current video block.

Motion estimation unit 204 and motion compensation unit 205 may performdifferent operations fora current video block, for example, depending onwhether the current video block is in an I slice, a P slice, or a Bslice.

In some examples, motion estimation unit 204 may perform uni-directionalprediction for the current video block, and motion estimation unit 204may search reference pictures of list 0 or list 1 for a reference videoblock for the current video block. Motion estimation unit 204 may thengenerate a reference index that indicates the reference picture in list0 or list 1 that contains the reference video block and a motion vectorthat indicates a spatial displacement between the current video blockand the reference video block. Motion estimation unit 204 may output thereference index, a prediction direction indicator, and the motion vectoras the motion information of the current video block. Motioncompensation unit 205 may generate the predicted video block of thecurrent block based on the reference video block indicated by the motioninformation of the current video block.

In other examples, motion estimation unit 204 may perform bi-directionalprediction for the current video block, motion estimation unit 204 maysearch the reference pictures in list 0 fora reference video block forthe current video block and may also search the reference pictures inlist 1 for another reference video block for the current video block.Motion estimation unit 204 may then generate reference indexes thatindicate the reference pictures in list 0 and list 1 containing thereference video blocks and motion vectors that indicate spatialdisplacements between the reference video blocks and the current videoblock. Motion estimation unit 204 may output the reference indexes andthe motion vectors of the current video block as the motion informationof the current video block. Motion compensation unit 205 may generatethe predicted video block of the current video block based on thereference video blocks indicated by the motion information of thecurrent video block.

In some examples, motion estimation unit 204 may output a full set ofmotion information for decoding processing of a decoder.

In some examples, motion estimation unit 204 may do not output a fullset of motion information for the current video. Rather, motionestimation unit 204 may signal the motion information of the currentvideo block with reference to the motion information of another videoblock. For example, motion estimation unit 204 may determine that themotion information of the current video block is sufficiently similar tothe motion information of a neighboring video block.

In one example, motion estimation unit 204 may indicate, in a syntaxstructure associated with the current video block, a value thatindicates to the video decoder 300 that the current video block has thesame motion information as the another video block.

In another example, motion estimation unit 204 may identify, in a syntaxstructure associated with the current video block, another video blockand a motion vector difference (MVD). The motion vector differenceindicates a difference between the motion vector of the current videoblock and the motion vector of the indicated video block. The videodecoder 300 may use the motion vector of the indicated video block andthe motion vector difference to determine the motion vector of thecurrent video block.

As discussed above, video encoder 200 may predictively signal the motionvector. Two examples of predictive signaling techniques that may beimplemented by video encoder 200 include advanced motion vectorpredication (AMVP) and merge mode signaling.

Intra prediction unit 206 may perform intra prediction on the currentvideo block. When intra prediction unit 206 performs intra prediction onthe current video block, intra prediction unit 206 may generateprediction data for the current video block based on decoded samples ofother video blocks in the same picture. The prediction data for thecurrent video block may include a predicted video block and varioussyntax elements.

Residual generation unit 207 may generate residual data for the currentvideo block by subtracting (e.g., indicated by the minus sign) thepredicted video block(s) of the current video block from the currentvideo block. The residual data of the current video block may includeresidual video blocks that correspond to different sample components ofthe samples in the current video block.

In other examples, there may be no residual data for the current videoblock for the current video block, for example in a skip mode, andresidual generation unit 207 may not perform the subtracting operation.

Transform processing unit 208 may generate one or more transformcoefficient video blocks for the current video block by applying one ormore transforms to a residual video block associated with the currentvideo block.

After transform processing unit 208 generates a transform coefficientvideo block associated with the current video block, quantization unit209 may quantize the transform coefficient video block associated withthe current video block based on one or more quantization parameter (QP)values associated with the current video block.

Inverse quantization unit 210 and inverse transform unit 211 may applyinverse quantization and inverse transforms to the transform coefficientvideo block, respectively, to reconstruct a residual video block fromthe transform coefficient video block. Reconstruction unit 212 may addthe reconstructed residual video block to corresponding samples from oneor more predicted video blocks generated by the predication unit 202 toproduce a reconstructed video block associated with the current blockfor storage in the buffer 213.

After reconstruction unit 212 reconstructs the video block, loopfiltering operation may be performed reduce video blocking artifacts inthe video block.

Entropy encoding unit 214 may receive data from other functionalcomponents of the video encoder 200. When entropy encoding unit 214receives the data, entropy encoding unit 214 may perform one or moreentropy encoding operations to generate entropy encoded data and outputa bitstream that includes the entropy encoded data.

FIG. 13 is a block diagram illustrating an example of video decoder 300which may be video decoder 114 in the system 100 illustrated in FIG. 15.

The video decoder 300 may be configured to perform any or all of thetechniques of this disclosure. In the example of FIG. 13, the videodecoder 300 includes a plurality of functional components. Thetechniques described in this disclosure may be shared among the variouscomponents of the video decoder 300. In some examples, a processor maybe configured to perform any or all of the techniques described in thisdisclosure.

In the example of FIG. 13, video decoder 300 includes an entropydecoding unit 301, a motion compensation unit 302, an intra predictionunit 303, an inverse quantization unit 304, an inverse transformationunit 305, and a reconstruction unit 306 and a buffer 307. Video decoder300 may, in some examples, perform a decoding pass generally reciprocalto the encoding pass described with respect to video encoder 200 (FIG.16).

Entropy decoding unit 301 may retrieve an encoded bitstream. The encodedbitstream may include entropy coded video data (e.g., encoded blocks ofvideo data). Entropy decoding unit 301 may decode the entropy codedvideo data, and from the entropy decoded video data, motion compensationunit 302 may determine motion information including motion vectors,motion vector precision, reference picture list indexes, and othermotion information. Motion compensation unit 302 may, for example,determine such information by performing the AMVP and merge mode.

Motion compensation unit 302 may produce motion compensated blocks,possibly performing interpolation based on interpolation filters.Identifiers for interpolation filters to be used with sub-pixelprecision may be included in the syntax elements.

Motion compensation unit 302 may use interpolation filters as used byvideo encoder 20 during encoding of the video block to calculateinterpolated values for sub-integer pixels of a reference block. Motioncompensation unit 302 may determine the interpolation filters used byvideo encoder 200 according to received syntax information and use theinterpolation filters to produce predictive blocks.

Motion compensation unit 302 may uses some of the syntax information todetermine sizes of blocks used to encode frame(s) and/or slice(s) of theencoded video sequence, partition information that describes how eachmacroblock of a picture of the encoded video sequence is partitioned,modes indicating how each partition is encoded, one or more referenceframes (and reference frame lists) for each inter-encoded block, andother information to decode the encoded video sequence.

Intra prediction unit 303 may use intra prediction modes for examplereceived in the bitstream to form a prediction block from spatiallyadjacent blocks. Inverse quantization unit 303 inverse quantizes, i.e.,de-quantizes, the quantized video block coefficients provided in thebitstream and decoded by entropy decoding unit 301. Inverse transformunit 303 applies an inverse transform.

Reconstruction unit 306 may sum the residual blocks with thecorresponding prediction blocks generated by motion compensation unit202 or intra-prediction unit 303 to form decoded blocks. If desired, adeblocking filter may also be applied to filter the decoded blocks inorder to remove blockiness artifacts. The decoded video blocks are thenstored in buffer 307, which provides reference blocks for subsequentmotion compensation/intra predication and also produces decoded videofor presentation on a display device.

In the present document, the term “video processing” may refer to videoencoding, video decoding, video compression or video decompression. Forexample, video compression algorithms may be applied during conversionfrom pixel representation of a video to a corresponding bitstreamrepresentation or vice versa. The bitstream representation, or codedrepresentation, of a current video block may, for example, correspond tobits that are either co-located or spread in different places within thebitstream, as is defined by the syntax. For example, a video block maybe encoded in terms of transformed and coded error residual values andalso using bits in headers and other fields in the bitstream.Furthermore, during conversion, a decoder may parse a bitstream with theknowledge that some fields may be present, or absent, based on thedetermination, as is described in the above solutions. Similarly, anencoder may determine that certain syntax fields are or are not to beincluded and generate the coded representation accordingly by includingor excluding the syntax fields from the coded representation.

FIG. 14 is a block diagram showing an example video processing system2000 in which various techniques disclosed herein may be implemented.Various implementations may include some or all of the components of thesystem 2000. The system 2000 may include input 2002 for receiving videocontent. The video content may be received in a raw or uncompressedformat, e.g., 8 or 10 bit multi-component pixel values, or may be in acompressed or encoded format. The input 2002 may represent a networkinterface, a peripheral bus interface, or a storage interface. Examplesof network interface include wired interfaces such as Ethernet, passiveoptical network (PON), etc. and wireless interfaces such as Wi-Fi orcellular interfaces.

The system 2000 may include a coding component 2004 that may implementthe various coding or encoding methods described in the presentdocument. The coding component 2004 may reduce the average bitrate ofvideo from the input 2002 to the output of the coding component 2004 toproduce a coded representation of the video. The coding techniques aretherefore sometimes called video compression or video transcodingtechniques. The output of the coding component 2004 may be eitherstored, or transmitted via a communication connected, as represented bythe component 2006. The stored or communicated bitstream (or coded)representation of the video received at the input 2002 may be used bythe component 2008 for generating pixel values or displayable video thatis sent to a display interface 2010. The process of generatinguser-viewable video from the bitstream representation is sometimescalled video decompression. Furthermore, while certain video processingoperations are referred to as “coding” operations or tools, it will beappreciated that the coding tools or operations are used at an encoderand corresponding decoding tools or operations that reverse the resultsof the coding will be performed by a decoder.

Examples of a peripheral bus interface or a display interface mayinclude universal serial bus (USB) or high definition multimediainterface (HDMI) or Displayport, and so on. Examples of storageinterfaces include SATA (serial advanced technology attachment), PCI,IDE interface, and the like. The techniques described in the presentdocument may be embodied in various electronic devices such as mobilephones, laptops, smartphones or other devices that are capable ofperforming digital data processing and/or video display.

FIG. 17 is a flowchart of an example method 1700 of video processing.The method 1700 comprises performing (1702) a conversion between a videoblock of a video and a coded representation of the video, wherein thecoded representation conforms to a format rule, wherein the format rulespecifies that applicability of a transform skip mode to the video blockis determined by a coding condition of the video block, wherein theformat rule specifies that a syntax element indicative of applicabilityof the transform skip mode is omitted from the coded representation, andwherein the transform skip mode includes, skipping applying a forwardtransform to at least some coefficients prior to encoding into the codedrepresentation, or during decoding, skipping applying an inversetransform to at least some coefficients prior to decoding from the codedrepresentation.

FIG. 18 is a flowchart of an example method 1800 of video processing.The method 1800 comprises determining (1802), for a conversion betweentwo adjacent video blocks of a video and a coded representation of thevideo, whether an in-loop filter or a post-reconstruction filter is tobe used for the conversion depending on whether a forward transform oran inverse transform is used for the conversion, wherein the forwardtransform includes, skipping applying the forward transform to at leastsome coefficients prior to encoding into the coded representation, orduring decoding, skipping applying the inverse transform to at leastsome coefficients prior to decoding from the coded representation; andperforming (1804) the conversion based on the use of the in-loop filteror the post-reconstruction filter.

FIG. 19 is a flowchart of an example method 1900 of video processing.The method 1900 comprises determining (1902), for a conversion between avideo block of a video and a coded representation of the video, to use ascaling tool due to a block differential pulse code modulation (BDPCM)coding tool or a quantized residual BDPCM (QR-BDPCM) coding tool beingused for the conversion of the video block; and performing (1904) theconversion using the scaling tool, wherein a syntax element in the codedrepresentation indicates use of the scaling tool, and wherein the use ofthe scaling tool comprises: scaling at least some coefficientsrepresenting the video block during encoding or descaling at least somecoefficients from the coded representation during decoding.

FIG. 20 is a flowchart of an example method 2000 of video processing.The method 2000 comprises determining (2002), for a conversion between avideo block of a video and a coded representation of the video, todisable use of a scaling tool due to to a block differential pulse codemodulation (BDPCM) coding tool or a quantized residual BDPCM (QR-BDPCM)coding tool for the conversion of the video block; and performing (2004)the conversion without using the scaling tool, wherein the use of thescaling tool comprises: scaling at least some coefficients representingthe video block during encoding or descaling at least some coefficientsfrom the coded representation during decoding.

FIG. 21 is a flowchart of an example method 2100 of video processing.The method 2100 comprises selecting (2102), fora conversion betweenvideo blocks of a video and a coded representation of the video, scalingmatrices based on a transform matrix selected for the conversion,wherein the scaling matrices are used to scale at least somecoefficients of the video blocks, and wherein the transform matrices areused to transform the at least some coefficients of the video blocksduring the conversion; and performing (2104) the conversion using thescaling matrices.

FIG. 22 is a flowchart of an example method 2200 of video processing.The method 2200 comprises determining (2202), according to a rule,whether to apply a scaling matrix based on whether a secondary transformmatrix is applied to a portion of a video block of a video, wherein thescaling matrix is used to scale at least some coefficients of the videoblock, and wherein the secondary transform matrix is used to transformat least some residual coefficients of the portion of the video blockduring the conversion; and performing (2204) a conversion between thevideo block of the video and a bitstream representation of the videousing the selected scaling matrix.

FIG. 23 is a flowchart of an example method 2300 of video processing.The method 2300 comprises determining (2302), for a video block that hasa non-square shape, a scaling matrix for use in a conversion between thevideo block of a video and a coded representation of the video, whereina syntax element in the coded representation signals the scaling matrix,and wherein the scaling matrix is used to scale at least somecoefficients of the video blocks during the conversion; and performing(2304) the conversion based on the scaling matrix.

FIG. 24 is a flowchart of an example method 2400 of video processing.The method 2400 comprises performing (2402) a conversion between a videoblock of a video and a coded representation of the video, wherein thevideo block comprises a first number of positions at which a scalingmatrix is applied during the conversion and a second number of positionsat which the scaling matrix is not applied during the conversion basedon a rule.

FIG. 25 is a flowchart of an example method 2500 of video processing.The method 2500 comprises determining (2502) that a scaling matrix is tobe applied during a conversion between a video block of a video and acoded representation of the video; and performing the conversion basedon the scaling matrix, wherein the coded representation indicates anumber of elements of the scaling matrix, and wherein the number dependson whether coefficient zeroing out is applied to coefficients of thevideo block.

FIG. 26 is a flowchart of an example method 2600 of video processing.The method 2600 comprises performing (2602) a conversion between a videoblock of a video and a coded representation of the video according to arule, wherein the video block is represented in the coded representationafter zeroing out all but top-left M×N transform coefficients afterapplying a K×L transform matrix to transform coefficients of the videoblock, wherein the coded representation is configured to excludesignaling of elements of a scaling matrix at positions corresponding tothe zeroing out, wherein the scaling matrix is used for scaling thetransform coefficients.

FIG. 27 is a flowchart of an example method 2700 of video processing.The method 2700 comprises determining (2702), during a conversionbetween a video block of a video and a coded representation of thevideo, based on a rule whether a single quantization matrix is to beused based on a size of the video block, wherein all video blocks havingthe size use the single quantization matrix; and performing theconversion using the quantization matrix.

The following three section describes example video processingtechniques that are numbered.

Section A

1. A method of video processing, comprising: performing a conversionbetween a video block of a video and a coded representation of thevideo, wherein the coded representation conforms to a format rule,wherein the format rule specifies that applicability of a transform skipmode to the video block is determined by a coding condition of the videoblock, wherein the format rule specifies that a syntax elementindicative of applicability of the transform skip mode is omitted fromthe coded representation, and wherein the transform skip mode includes,skipping applying a forward transform to at least some coefficientsprior to encoding into the coded representation, or during decoding,skipping applying an inverse transform to at least some coefficientsprior to decoding from the coded representation.

2. The method of example 1, wherein the transform skip mode isdetermined to be enabled due to the coding condition of the video blockindicating that a block differential pulse code modulation (BDPCM) or aquantized residual BDPCM (QR-BDPCM) is used on the video block.

3. The method of example 1, wherein the transform skip mode isdetermined to be disabled due to the coding condition of the video blockindicating that a non-block differential pulse code modulation(non-BDPCM) or a non-quantized residual BDPCM (non-QR-BDPCM) is used onthe video block.

4. A method of video processing, comprising: determining, foraconversion between two adjacent video blocks of a video and a codedrepresentation of the video, whether an in-loop filter or apost-reconstruction filter is to be used for the conversion depending onwhether a forward transform or an inverse transform is used for theconversion, wherein the forward transform includes, skipping applyingthe forward transform to at least some coefficients prior to encodinginto the coded representation, or during decoding, skipping applying theinverse transform to at least some coefficients prior to decoding fromthe coded representation; and performing the conversion based on the useof the in-loop filter or the post-reconstruction filter.

5. The method of example 4, wherein the forward transform or inversetransform include a transform skip mode or a block differential pulsecode modulation (BDPCM) or a quantized residual BDPCM (QR-BDPCM) or apalette mode, and wherein the use of the in-loop filter or thepost-reconstruction filter to the two adjacent video blocks is based onwhether the transform skip mode or a block differential pulse codemodulation (BDPCM) or a quantized residual BDPCM (QR-BDPCM) or a palettemode is used on the two adjacent video blocks.

6. The method of example 4, wherein the forward transform or inversetransform include a transform skip mode, and wherein a derivation of aboundary filtering strength depends on one or more syntax elements thatindicates whether the transform skip mode is enabled for one or both ofthe two adjacent video blocks.

7. The method of example 4, wherein the forward transform or inversetransform include a transform skip mode, and wherein a deblockingfilter, a sample adaptive offset, an adaptive loop filter, or thepost-reconstruction filter are disabled in response to the sampleslocated at the two adjacent video blocks being coded with the transformskip mode.

8. The method of example 7, wherein the forward transform or inversetransform include a transform skip mode, and wherein the in-loop filterand the post-reconstruction filter are not applied to the edge betweenthe two adjacent video blocks in response to the transform skip modebeing enabled for the two adjacent video blocks.

9. The method of example 7, wherein the forward transform or inversetransform include a transform skip mode, and wherein the in-loop filterand the post-reconstruction filter are not applied to the samplesbetween the two adjacent video blocks in response to the transform skipmode being enabled for one of the two adjacent video blocks.

10. The method of example 4, wherein the forward transform or inversetransform include a transform skip mode, and wherein the samples arefiltered using a filter other than the in-loop filter or thepost-reconstruction filter in response to the transform skip mode beingenabled for the two adjacent video blocks.

11. The method of example 10, wherein the filter comprises a smootherfilter.

12. The method of example 4, wherein the video comprises a video blockthat is coded with a pulse code modulation (PCM) or a block differentialpulse code modulation (BDPCM) or a quantized residual BDPCM (QR-BDPCM)or another type of mode in which the forward transform or the inversetransform is not applied to the video block, and wherein whether thein-loop filter or the post-reconstruction filter are used for theconversion of the video block is determined in a same way as that forthe two adjacent video blocks when a transform skip mode is enabled forthe two adjacent video blocks.

13. The method of any of examples 4-12, wherein the in-loop filtercomprises a de-blocking filter.

14. The method of any of examples 4-12, wherein the post-reconstructionfilter comprises a bilateral filter or a diffusion filter.

15. The method of any of examples 1 to 14, wherein the conversioncomprises encoding the video block into the coded representation.

16. The method of any of examples 1 to 14, wherein the conversioncomprises decoding the coded representation to generate pixel values ofthe video block.

17. A video decoding apparatus comprising a processor configured toimplement a method recited in one or more of examples 1 to 16.

18. A computer program product having computer code stored thereon, thecode, when executed by a processor, causes the processor to implement amethod recited in any of examples 1 to 17.

Section B

1. A method of video processing, comprising: determining, foraconversion between a video block of a video and a coded representationof the video, factors of a scaling tool based on a coding mode of thevideo block; and performing the conversion using the scaling tool,wherein the use of the scaling tool comprises: scaling at least somecoefficients representing the video block during encoding or descalingat least some coefficients from the coded representation duringdecoding.

2. The method of example 1, further comprising: determining the factorsof the scaling tool based on a predefined value in response to a blockdifferential pulse code modulation (BDPCM) coding tool or a quantizedresidual BDPCM (QR-BDPCM) coding tool being used for the conversion ofthe video block.

3. The method of example 2, wherein the factors of the scaling tool usedfor the video block on which the BDPCM coding tool or the QR-BDPCMcoding tool is applied are same as that used for the video block onwhich a transform skip mode is applied, and wherein the transform skipmode includes, skipping applying a forward transform to the at leastsome coefficients prior to encoding into the coded representation, orduring decoding, skipping applying an inverse transform to the at leastsome coefficients prior to decoding from the coded representation.

4. The method of example 2, wherein the conversion includes determiningthe factors of the scaling tool based on one or more transforms appliedto the at least some coefficients of the video block during theconversion.

5. The method of example 4, wherein the scaling tool is allowed for theconversion in response to the one or more transforms being applied tothe at least some coefficients of the video block.

6. The method of example 4, wherein a technique for determining thefactors of the scaling tool is the same as that used for an intra codedblock in response to the one or more transforms being applied to the atleast some coefficients of the video block.

7. The method of example 1, wherein the factors of the scaling matrixare determined in a same way for video blocks of the video that arecoded using an intra block copy mode and an inter mode.

8. A method of video processing, comprising: determining, foraconversion between a video block of a video and a coded representationof the video, to disable use of a scaling tool due to a blockdifferential pulse code modulation (BDPCM) coding tool or a quantizedresidual BDPCM (QR-BDPCM) coding tool for the conversion of the videoblock; and performing the conversion without using the scaling tool,wherein the use of the scaling tool comprises: scaling at least somecoefficients representing the video block during encoding or descalingat least some coefficients from the coded representation duringdecoding.

9. A method of video processing, comprising: selecting, for a conversionbetween video blocks of a video and a coded representation of the video,scaling matrices based on a transform matrix selected for theconversion, wherein the scaling matrices are used to scale at least somecoefficients of the video blocks, and wherein the transform matrices areused to transform the at least some coefficients of the video blocksduring the conversion; and performing the conversion using the scalingmatrices.

10. The method of example 9, wherein the selecting the scaling matricesis based on whether the conversion of the video blocks uses a defaulttransform mode.

11. The method of example 10, wherein the default transform modeincludes a discrete cosine transform 2 (DCT2).

12. The method of example 9, wherein the scaling matrices are separatelysignaled for multiple transform matrices.

13. The method of example 9, wherein the selecting the scaling matricesis based on motion information of the video blocks.

15. The method of example 13, wherein the selecting the scaling matricesis based on whether the conversion of the video blocks uses a sub-blockcoding mode.

15. The method of example 14, wherein the sub-block coding mode includesan affine coding mode.

16. The method of example 15, wherein a scaling matrix for the affinecoding mode is signaled differently than that for another video blockwhose conversion uses a non-affine coding mode.

17. The method of example 13, wherein the selecting the scaling matricesis based on whether the video blocks are coded with affine intraprediction mode.

18. The method of any of examples 1 to 17, wherein the conversioncomprises encoding the video block or the video blocks into the codedrepresentation.

19. The method of any of examples 1 to 17, wherein the conversioncomprises decoding the coded representation to generate pixel values ofthe video block or of the video blocks.

20. A video decoding apparatus comprising a processor configured toimplement a method recited in one or more of examples 1 to 19.

21. A video encoding apparatus comprising a processor configured toimplement a method recited in one or more of examples 1 to 19.

22. A computer program product having computer code stored thereon, thecode, when executed by a processor, causes the processor to implement amethod recited in any of examples 1 to 19.

Section C

1. A method of video processing, comprising: determining, according to arule, whether to apply a scaling matrix based on whether a secondarytransform matrix is applied to a portion of a video block of a video,wherein the scaling matrix is used to scale at least some coefficientsof the video block, and wherein the secondary transform matrix is usedto transform at least some residual coefficients of the portion of thevideo block during the conversion; and performing a conversion betweenthe video block of the video and a bitstream representation of the videousing the selected scaling matrix.

2. The method of example 1, wherein the rule specifies that the scalingmatrix is applied to an M×N top left portion of the video block inresponse to the secondary transform matrix being applied to the M×N topleft portion of the video block that includes a K×L transform blocksize.

3. The method of example 1, wherein the scaling matrix is signaled inthe bitstream representation.

4. The method of example 3, wherein the scaling matrix is signaled in atile group header, a slide header, a picture parameter set (PPS), avideo parameter set (VPS), a sequence parameter set (SPS) for thesecondary transform matrix or for a reduced secondary transform or arotation transform.

5. The method of example 1, wherein the bitstream representationincludes a first syntax element that indicates whether the scalingmatrix is applied, and wherein the bitstream representation includes asecond syntax element that indicates whether the secondary transformmatrix is applied.

6. The method of example 1, wherein the rule specifies that the scalingmatrix is only applied to portions of the video block in which thesecondary transform matrix is not applied.

7. The method of example 1, wherein the rule specifies that the thescaling matrix is applied to portions except a M×N top left portion ofthe video block on which the secondary transform matrix is applied.

8. The method of example 1, wherein the rule specifies that the scalingmatrix is applied only to portions of the video block on which thesecondary transform matrix is applied.

9. A method of video processing, comprising: determining, fora videoblock that has a non-square shape, a scaling matrix for use in aconversion between the video block of a video and a coded representationof the video, wherein a syntax element in the coded representationsignals the scaling matrix, and wherein the scaling matrix is used toscale at least some coefficients of the video blocks during theconversion; and performing the conversion based on the scaling matrix.

10. The method of example 9, wherein the syntax element predictivelycodes the scaling matrix from another scaling matrix of a previoussquare block of the video.

11. A method of video processing, comprising: performing a conversionbetween a video block of a video and a coded representation of thevideo, wherein the video block comprises a first number of positions atwhich a scaling matrix is applied during the conversion and a secondnumber of positions at which the scaling matrix is not applied duringthe conversion based on a rule.

12. The method of example 11, wherein the first number of positionscomprises top-left M*N positions of the video block, and wherein thevideo block comprises more than M*N positions.

13. The method of example 11, wherein the first number of positionscomprises top M*N positions of the video block, and wherein the videoblock comprises more than M*N positions.

14. The method of example 11, wherein the first number of positionscomprises left M*N positions of the video block, and wherein the videoblock comprises more than M*N positions.

15. A method of video processing, comprising: determining that a scalingmatrix is to be applied during a conversion between a video block of avideo and a coded representation of the video; and performing theconversion based on the scaling matrix, wherein the coded representationindicates a number of elements of the scaling matrix, and wherein thenumber depends on whether coefficient zeroing out is applied tocoefficients of the video block.

16. The method of example 15, wherein fora 64×64 transform, theconversion includes zeroing out all but top-left M×N positions of thevideo block, and wherein the number of elements of the scaling matrix isM/8*N/8.

17. A method of video processing, comprising: performing a conversionbetween a video block of a video and a coded representation of the videoaccording to a rule, wherein the video block is represented in the codedrepresentation after zeroing out all but top-left M×N transformcoefficients after applying a K×L transform matrix to transformcoefficients of the video block, wherein the coded representation isconfigured to exclude signaling of elements of a scaling matrix atpositions corresponding to the zeroing out, wherein the scaling matrixis used for scaling the transform coefficients.

18. The method of example 17, wherein the signaling of elements of thescaling matrix located in regions outside of the top-left M×Ncoefficients is skipped.

19. The method of example 17, wherein the scaling matrix is applied bysub-sampling by a ratio determined from the K and/or the L.

20. The method of example 19, wherein the video block is split intomultiple sub-regions, and wherein a size of each sub-region is Uw*Uh,and wherein one element of the scaling matrix located within eachsub-region of a region comprising a top-left M×N coefficients of thevideo block is signaled in the coded representation.

21. The method of example 19, wherein a number of the elements of thescaling matrix indicated in the coded representation is based on the Mand/or the N.

22. The method of example 19, wherein a first number of the elements ofthe scaling matrix indicated in the coded representation for the K×Ltransform matrix is different from a second number of the elements ofthe scaling matrix indicated in the coded representation for thetop-left M×N coefficients without zeroing out.

23. The method of example 17, wherein the scaling matrix is applied bysub-sampling by a ratio determined from the M and/or the N.

24. The method of example 23, wherein a region comprising the top-leftM×N coefficients is split into multiple sub-regions, wherein a size ofeach sub-region is Uw*Uh, and wherein one element within each sub-regionis signaled in the coded representation.

25. The method of example 23, wherein a number of the elements of thescaling matrix indicated in the coded representation for the K×Ltransform matrix is same as that indicated in the coded representationfor the top-left M×N coefficients without zeroing out.

26. The method of any of example 17 to 25, wherein K=L=64, and whereinM=N=32.

27. The method of any of example 20 or 24, wherein K=L=64, whereinM=N=32, and wherein Uw=Uh=8.

28. A method of video processing, comprising: determining, during aconversion between a video block of a video and a coded representationof the video, based on a rule whether a single quantization matrix is tobe used based on a size of the video block, wherein all video blockshaving the size use the single quantization matrix; and performing theconversion using the quantization matrix.

29. The method of example 28, wherein the rule specifies that only thesingle quantization matrix is allowed in response to the size of thevideo block being smaller than W×H, where W and H are integers.

30. The method of example 28, wherein the rule specifies that only thesingle quantization matrix is allowed in response to a width of thevideo block is smaller than a threshold.

31. The method of example 28, wherein the rule specifies that only thesingle quantization matrix is allowed in response to a height of thevideo block is smaller than a threshold.

32. The method of example 28, wherein the rule specifies that the singlequantization matrix is not applied to the video block having the sizeassociated with a small size video block.

33. The method of any of examples 1 to 32, wherein a palette mode isapplied to the video block.

34. The method of any of examples 1 to 33, wherein the conversioncomprises encoding the video into the coded representation.

35. The method of any of examples 1 to 33, wherein the conversioncomprises decoding the coded representation to generate pixel values ofthe video block.

36. A video decoding apparatus comprising a processor configured toimplement a method recited in one or more of examples 1 to 35.

37. A video encoding apparatus comprising a processor configured toimplement a method recited in one or more of examples 1 to 35.

38. A computer program product having computer code stored thereon, thecode, when executed by a processor, causes the processor to implement amethod recited in any of examples 1 to 35.

The disclosed and other solutions, examples, embodiments, modules andthe functional operations described in this document can be implementedin digital electronic circuitry, or in computer software, firmware, orhardware, including the structures disclosed in this document and theirstructural equivalents, or in combinations of one or more of them. Thedisclosed and other embodiments can be implemented as one or morecomputer program products, i.e., one or more modules of computer programinstructions encoded on a computer readable medium for execution by, orto control the operation of, data processing apparatus. The computerreadable medium can be a machine-readable storage device, amachine-readable storage substrate, a memory device, a composition ofmatter effecting a machine-readable propagated signal, or a combinationof one or more them. The term “data processing apparatus” encompassesall apparatus, devices, and machines for processing data, including byway of example a programmable processor, a computer, or multipleprocessors or computers. The apparatus can include, in addition tohardware, code that creates an execution environment for the computerprogram in question, e.g., code that constitutes processor firmware, aprotocol stack, a database management system, an operating system, or acombination of one or more of them. A propagated signal is anartificially generated signal, e.g., a machine-generated electrical,optical, or electromagnetic signal, that is generated to encodeinformation for transmission to suitable receiver apparatus.

A computer program (also known as a program, software, softwareapplication, script, or code) can be written in any form of programminglanguage, including compiled or interpreted languages, and it can bedeployed in any form, including as a stand-alone program or as a module,component, subroutine, or other unit suitable for use in a computingenvironment. A computer program does not necessarily correspond to afile in a file system. A program can be stored in a portion of a filethat holds other programs or data (e.g., one or more scripts stored in amarkup language document), in a single file dedicated to the program inquestion, or in multiple coordinated files (e.g., files that store oneor more modules, sub programs, or portions of code). A computer programcan be deployed to be executed on one computer or on multiple computersthat are located at one site or distributed across multiple sites andinterconnected by a communication network.

The processes and logic flows described in this document can beperformed by one or more programmable processors executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application specific integrated circuit).

Processors suitable for the execution of a computer program include, byway of example, both general and special purpose microprocessors, andany one or more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read only memory ora random-access memory or both. The essential elements of a computer area processor for performing instructions and one or more memory devicesfor storing instructions and data. Generally, a computer will alsoinclude, or be operatively coupled to receive data from or transfer datato, or both, one or more mass storage devices for storing data, e.g.,magnetic, magneto optical disks, or optical disks. However, a computerneed not have such devices. Computer readable media suitable for storingcomputer program instructions and data include all forms of non-volatilememory, media and memory devices, including by way of examplesemiconductor memory devices, e.g., EPROM, EEPROM, and flash memorydevices; magnetic disks, e.g., internal hard disks or removable disks;magneto optical disks; and CD ROM and DVD-ROM disks. The processor andthe memory can be supplemented by, or incorporated in, special purposelogic circuitry.

While this patent document contains many specifics, these should not beconstrued as limitations on the scope of any subject matter or of whatmay be claimed, but rather as descriptions of features that may bespecific to particular embodiments of particular techniques. Certainfeatures that are described in this patent document in the context ofseparate embodiments can also be implemented in combination in a singleembodiment. Conversely, various features that are described in thecontext of a single embodiment can also be implemented in multipleembodiments separately or in any suitable subcombination. Moreover,although features may be described above as acting in certaincombinations and even initially claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claimed combination may be directed to asubcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. Moreover, the separation of various system components in theembodiments described in this patent document should not be understoodas requiring such separation in all embodiments.

Only a few implementations and examples are described and otherimplementations, enhancements and variations can be made based on whatis described and illustrated in this patent document.

What is claimed is:
 1. A method of processing video data, comprising:determining, during a conversion between a video transform block of avideo with a K×L transform block size and a bitstream of the video, thata scaling matrix is applied to the video transform block in a case thata secondary transform matrix is applied to an S×T top left portion ofthe video transform block, wherein S, T, K and L are integers and K isgreater than or equal to S, L is greater than or equal to T, wherein thescaling matrix is used to scale at least some coefficients of the videotransform block, and performing the conversion using the scaling matrix.2. The method of claim 1, wherein the scaling matrix is effectivelyapplied only to the S×T top left portion of the video transform block.3. The method of claim 1, wherein the scaling matrix comprises a defaultmatrix or a matrix explicitly included in the bitstream.
 4. The methodof claim 3, wherein matrix elements of the default matrix are flat withvalues equal to
 16. 5. The method of claim 1, wherein in response to theK×L video transform block containing more than M×N positions, onlymatrix elements within a top-left M×N region of the K×L video transformblock are kept and remaining matrix elements are zeroing-out, where Mand N are integers.
 6. The method of claim 5, wherein M=32, and N=32. 7.The method of claim 5, wherein when K is equal to 64, only left 32column matrix elements of the scaling matrix are kept, when L is equalto 64, only top 32 row matrix elements of the scaling matrix are kept,and remaining matrix elements are zeroing-out.
 8. The method of claim 1,wherein the conversion includes encoding the video transform block intothe bitstream.
 9. The method of claim 1, wherein the conversion includesdecoding the video transform block from the bitstream.
 10. An apparatusfor processing video data comprising a processor and a non-transitorymemory with instructions thereon, wherein the instructions uponexecution by the processor, cause the processor to: determine, during aconversion between a video transform block of a video with a K×Ltransform block size and a bitstream of the video, that a scaling matrixis applied to the video transform block in a case that a secondarytransform matrix is applied to an S×T top left portion of the videotransform block, wherein S, T, K and L are integers and K is greaterthan or equal to S, L is greater than or equal to T, wherein the scalingmatrix is used to scale at least some coefficients of the videotransform block, and perform the conversion using the scaling matrix.11. The apparatus of claim 10, wherein the scaling matrix is effectivelyapplied only to the S×T top left portion of the video transform block.12. The apparatus of claim 10, wherein the scaling matrix comprises adefault matrix or a matrix explicitly included in the bitstream; andwherein matrix elements of the default matrix are flat with values equalto
 16. 13. The apparatus of claim 10, wherein in response to the K×Lvideo transform block containing more than M×N positions, only matrixelements within a top-left M×N region of the K×L video transform blockare kept and remaining matrix elements are zeroing-out, where M and Nare integers; wherein M=32, and N=32; and wherein when K is equal to 64,only left 32 column matrix elements of the scaling matrix are kept, whenL is equal to 64, only top 32 row matrix elements of the scaling matrixare kept, and remaining matrix elements are zeroing-out.
 14. Anon-transitory computer-readable storage medium storing instructionsthat cause a processor to: determine, during a conversion between avideo transform block of a video with a K×L transform block size and abitstream of the video, that a scaling matrix is applied to the videotransform block in a case that a secondary transform matrix is appliedto an S×T top left portion of the video transform block, wherein S, T, Kand L are integers and K is greater than or equal to S, L is greaterthan or equal to T, wherein the scaling matrix is used to scale at leastsome coefficients of the video transform block, and perform theconversion using the scaling matrix.
 15. The non-transitorycomputer-readable storage medium of claim 14, wherein the scaling matrixis effectively applied only to the S×T top left portion of the videotransform block.
 16. The non-transitory computer-readable storage mediumof claim 14, wherein the scaling matrix comprises a default matrix or amatrix explicitly included in the bitstream; and wherein matrix elementsof the default matrix are flat with values equal to
 16. 17. Thenon-transitory computer-readable storage medium of claim 14, wherein inresponse to the K×L video transform block containing more than M×Npositions, only matrix elements within a top-left M×N region of the K×Lvideo transform block are kept and remaining matrix elements arezeroing-out, where M and N are integers; wherein M=32, and N=32; andwherein when K is equal to 64, only left 32 column matrix elements ofthe scaling matrix are kept, when L is equal to 64, only top 32 rowmatrix elements of the scaling matrix are kept, and remaining matrixelements are zeroing-out.
 18. A non-transitory computer-readablerecording medium storing a bitstream of a video which is generated by amethod performed by a video processing apparatus, wherein the methodcomprises: determining that a scaling matrix is applied to a videotransform block of a video with a K×L transform block size in a casethat a secondary transform matrix is applied to an S×T top left portionof the video transform block, wherein S, T, K and L are integers and Kis greater than or equal to S, L is greater than or equal to T, whereinthe scaling matrix is used to scale at least some coefficients of thevideo transform block, and generating the bitstream using the scalingmatrix.
 19. The non-transitory computer-readable recording medium ofclaim 18, wherein the scaling matrix is effectively applied only to theS×T top left portion of the video transform block; wherein the scalingmatrix comprises a default matrix or a matrix explicitly included in thebitstream; and wherein matrix elements of the default matrix are flatwith values equal to
 16. 20. The non-transitory computer-readablerecording medium of claim 18, wherein in response to the K×L videotransform block containing more than M×N positions, only matrix elementswithin a top-left M×N region of the K×L video transform block are keptand remaining matrix elements are zeroing-out, where M and N areintegers; wherein M=32, and N=32; and wherein when K is equal to 64,only left 32 column matrix elements of the scaling matrix are kept, whenL is equal to 64, only top 32 row matrix elements of the scaling matrixare kept, and remaining matrix elements are zeroing-out.